Macro tonic::include_proto

source ·
macro_rules! include_proto {
    ($package: tt) => { ... };
}
Expand description

Include generated proto server and client items.

You must specify the gRPC package name.

mod pb {
    tonic::include_proto!("helloworld");
}

§Note:

This only works if the tonic-build output directory has been unmodified. The default output directory is set to the OUT_DIR environment variable. If the output directory has been modified, the following pattern may be used instead of this macro.

mod pb {
    include!("/relative/protobuf/directory/helloworld.rs");
}

You can also use a custom environment variable using the following pattern.

mod pb {
    include!(concat!(env!("PROTOBUFS"), "/helloworld.rs"));
}