Crate prost_reflect_build
source ·Expand description
prost-reflect-build
contains Builder
to configure prost_build::Config
to derive prost_reflect::ReflectMessage
for all messages in protocol buffers.
The simplest way to generate protocol buffer API:
// build.rs
use prost_reflect_build::Builder;
Builder::new()
.compile_protos(&["path/to/protobuf.proto"], &["path/to/include"])
.expect("Failed to compile protos");
With default configuration, lib.rs
must include the following lines for reflection.
ⓘ
static DESCRIPTOR_POOL: Lazy<DescriptorPool> = Lazy::new(|| DescriptorPool::decode(
include_bytes!(concat!(env!("OUT_DIR"), "file_descriptor_set.bin")).as_ref()
).unwrap());
// `include!` generated code may appear anywhere in the crate.
include!(concat!(env!("OUT_DIR"), "protobuf.rs"));
Structs§
- Configuration builder for prost-reflect code generation.