A protoc plugin that generates code using the Prost! code generation engine.
When used in projects that use only Rust code, the preferred mechanism for
generating protobuf definitions with Prost! is to use prost-build from
within a build.rs file. However, when working in polyglot environments,
it can be advantageous to utilize common tooling in the Protocol Buffers
ecosystem. One common tool used for this purpose is buf, which simplifies
the code generation process and includes several useful features, including
linting, package management, and breaking change detection.
The various modules that are used for generating Rust code with Prost! and Tonic are available in the named subdirectories. Refer to the README in each of those folders for more information.
buf.gen.yamlNote: When executing protoc-gen-prost-crate with the gen_crate option, remote
generation is not possible, as the manifest template is not made available to a
remote plugin.
version: v2
plugins:
- remote: buf.build/community/neoeinstein-prost:v0.4.0
out: gen/src
opt:
- bytes=.
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
- file_descriptor_set
- remote: buf.build/community/neoeinstein-prost-serde:v0.3.1
out: gen/src
- remote: buf.build/community/neoeinstein-tonic:v0.4.1
out: gen/src
opt:
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
- local: protoc-gen-prost-crate
out: gen
strategy: all
opt:
- gen_crate=Cargo.toml
See example/build-with-buf for an example of invoking buf as part of a
build.rs build script. This may be useful when you want to extend the
generated files with additional trait or inherent implementations.
See example/wkt-reflection-with-buf for registering well-known type file
descriptor sets from protoc-wkt when exposing a gRPC reflection endpoint.
Rust
99.9%
A protoc plugin that generates code using the Prost! code generation engine.
When used in projects that use only Rust code, the preferred mechanism for
generating protobuf definitions with Prost! is to use prost-build from
within a build.rs file. However, when working in polyglot environments,
it can be advantageous to utilize common tooling in the Protocol Buffers
ecosystem. One common tool used for this purpose is buf, which simplifies
the code generation process and includes several useful features, including
linting, package management, and breaking change detection.
The various modules that are used for generating Rust code with Prost! and Tonic are available in the named subdirectories. Refer to the README in each of those folders for more information.
buf.gen.yamlNote: When executing protoc-gen-prost-crate with the gen_crate option, remote
generation is not possible, as the manifest template is not made available to a
remote plugin.
version: v2
plugins:
- remote: buf.build/community/neoeinstein-prost:v0.4.0
out: gen/src
opt:
- bytes=.
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
- file_descriptor_set
- remote: buf.build/community/neoeinstein-prost-serde:v0.3.1
out: gen/src
- remote: buf.build/community/neoeinstein-tonic:v0.4.1
out: gen/src
opt:
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
- local: protoc-gen-prost-crate
out: gen
strategy: all
opt:
- gen_crate=Cargo.toml
See example/build-with-buf for an example of invoking buf as part of a
build.rs build script. This may be useful when you want to extend the
generated files with additional trait or inherent implementations.
See example/wkt-reflection-with-buf for registering well-known type file
descriptor sets from protoc-wkt when exposing a gRPC reflection endpoint.
Rust
99.9%