diff --git a/tonic/src/macros.rs b/tonic/src/macros.rs index beb0c3b..828e70e 100644 --- a/tonic/src/macros.rs +++ b/tonic/src/macros.rs @@ -7,6 +7,26 @@ /// 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. +/// +/// ```rust,ignore +/// mod pb { +/// include!("/relative/protobuf/directory/helloworld.rs"); +/// } +/// ``` +/// You can also use a custom environment variable using the following pattern. +/// ```rust,ignore +/// mod pb { +/// include!(concat!(env!("PROTOBUFS"), concat!("/helloworld.rs"))); +/// } +/// ``` +/// +/// [`OUT_DIR`]: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts #[macro_export] macro_rules! include_proto { ($package: tt) => {