chore(docs): Add documentation for modified tonic-build output directory (#40)
* improve docs for modified OUT_DIR * rustfmt
This commit is contained in:
committed by
Lucio Franco
parent
0218d58c28
commit
2b564aeb06
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user