Function prost_build::compile_fds

source ·
pub fn compile_fds(fds: FileDescriptorSet) -> Result<()>
Expand description

Compile a FileDescriptorSet into Rust files during a Cargo build.

The generated .rs files are written to the Cargo OUT_DIR directory, suitable for use with the [include!][1] macro. See the [Cargo build.rs code generation][2] example for more info.

This function should be called in a project’s build.rs.

This function can be combined with a crate like protox which outputs a FileDescriptorSet and is a pure Rust implementation of protoc.

§Example

fn main() -> std::io::Result<()> {
  let file_descriptor_set = fds();

  prost_build::compile_fds(file_descriptor_set)
}