Skip to content

Commit

Permalink
chore(docs): Add documentation for modified tonic-build output direct…
Browse files Browse the repository at this point in the history
…ory (#40)

* improve docs for modified OUT_DIR

* rustfmt
  • Loading branch information
JohnDoneth authored and LucioFranco committed Oct 4, 2019
1 parent 0218d58 commit 2b564ae
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tonic/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 2b564ae

Please sign in to comment.