如何为buf命令行添加RUST插件,以便为protofile生成rust库

tquggr8v  于 2023-02-04  发布在  其他
关注(0)|答案(1)|浏览(198)

我正在这个githib库中做gRPC实验,使用buf cli来生成gRPC服务器和客户端库。我在GoLang中使用它,但是我想为RUST生成库。
Git回购位于:https://github.com/vinceyoumans/wc6
buf文件位于:buf.gen.yaml
我已经将RUST代码注解掉了,但我相信问题是我没有正确的RUST插件。使用buf cli的文档几乎不存在。我不是一个RUSTMaven。我正在寻找关于如何做到这一点的策略指导。
要使用buf的yaml文件是...

Documentation: https://docs.buf.build/configuration/v1/buf-gen-yaml
version: v1
plugins:
  - name: go # Synonym with: protoc-gen-<name>
    out: gen/go
    opt: paths=source_relative
  - name: go-grpc
    out: gen/go
    opt:
      - paths=source_relative
      - require_unimplemented_servers=false
#  - name: rust
#    out: gen/rust
#    opt: paths=source_relative
#  - name: rust
#    out: gen/rust
#    opt: paths=source_relative
fykwrbwg

fykwrbwg1#

看一看https://docs.rs/protoc-gen-prost/latest/protoc_gen_prost/
有使用prost的配置。类似。

version: v1
plugins:
  - name: prost
    out: gen
    opt:
      - bytes=.
      - compile_well_known_types
      - extern_path=.google.protobuf=::pbjson_types
      - file_descriptor_set
      - type_attribute=.helloworld.v1.HelloWorld=#[derive(Eq\, Hash)]

相关问题