Function proto_build_tools::build_protos
source · pub fn build_protos(out_dir: &PathBuf, proto_paths: &[PathBuf])
Expand description
Builds a set of Rust protos based on the provided proto files. The individual protos will be
dumped into out_dir
(will be created if needed), along with a file that wraps them
out_dir/generated.rs
. The wrapper file can then be included using a pattern like:
ⓘ
pub mod protos {
// Suppose the `out_dir` supplied to `build_protos` was
// format!("{}/my_crate_protos", env!("OUT_DIR"))
include!(concat!(env!("OUT_DIR"), "/my_crate_protos/generated.rs"));
}
// Protos are available at protos::proto_file_name.