prost-reflect-build 0.8.0

A utility function for use with prost-build and prost-reflect to generate ReflectMessage implementations
Documentation

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"));