File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,22 @@ pub mod text;
6464pub mod text_list;
6565pub mod traits;
6666
67- /// Macro for importing a Rust file generated by a `build.rs` file using
68- /// `capnpc::CompilerCommand`.
67+ /// Macro for importing Rust code that has been generated by `capnpc::CompilerCommand`.
6968///
70- /// Typically, a schema file named `foo.capnp` should have a `mod_name`
71- /// of `foo_capnp` and a `file_name` of `"foo_capnp.rs"`.
69+ /// For example:
70+ /// ```ignore
71+ /// generated_code!(pub mod foo_capnp);
72+ /// ```
73+ /// pulls in the generated code for `foo.capnp` into a module named `foo_capnp`.
74+ /// It expects to find the generated code in a file `$OUT_DIR/foo_capnp.rs`,
75+ /// where `OUT_DIR` is Cargo's standard environment variable giving the
76+ /// location of the output of `build.rs`.
77+ ///
78+ /// If the generated code lives in a nonstandard location—perhaps in a subdirectory
79+ /// of `OUT_DIR`—you can specify its path as a second argument:
80+ /// ```ignore
81+ /// generated_code!(pub mod foo_capnp, "some_directory/foo_capnp.rs");
82+ /// ```
7283#[ macro_export]
7384macro_rules! generated_code {
7485 ( $vis: vis mod $mod_name: ident, $file_name: expr) => {
You can’t perform that action at this time.
0 commit comments