Function compile_protos
pub fn compile_protos<P>(protos: &[P], includes: &[P]) -> Result<(), Error>Available on crate feature
ttrpc only.Expand description
Compile .proto files into Rust ttRPC stubs during a Cargo build.
The generated .rs files are written to the Cargo OUT_DIR directory, suitable for use
with the include! macro (or rama_ttrpc::include_proto!). This should be called from
a project’s build.rs. Use configure instead when you need more options.
§Arguments
protos - Paths to .proto files to compile. Any transitively imported .proto
files are automatically included.
includes - Paths to directories in which to search for imports.
§Errors
Fails if protoc cannot be located, the .protos cannot be parsed or compiled, or the
output cannot be written. It is expected to be unwraped in a build.rs.
§Example build.rs
fn main() -> std::io::Result<()> {
rama_ttrpc_build::compile_protos(&["src/frontend.proto", "src/backend.proto"], &["src"])?;
Ok(())
}