简体   繁体   中英

How would I add a RUST plugin for a buf command line to generate rust libraries for protofile

I am working on a gRPC experiment at this githib repo, using buf cli to generate the gRPC server and Client libraries. I have it working in GoLang but I want to generate libraries for RUST.

The git repo is at: https://github.com/vinceyoumans/wc6

The buf file is at: buf.gen.yaml

I have RUST code commented out but I believe the problem is that I do not have correct plugin for RUST. The documentation to use the buf cli is almost nonexistent with buf. I am not a RUST expert either way. I am looking for guidance for strategies on how this should be done.

yaml file to use buf is...

 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

Take a look at https://docs.rs/protoc-gen-prost/latest/protoc_gen_prost/

There's configuration for using prost. Something like.

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)]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM