tonic

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