generated_code

Macro generated_code 

Source
macro_rules! generated_code {
    ($vis:vis mod $mod_name:ident, $file_name:expr) => { ... };
    ($vis:vis mod $mod_name:ident) => { ... };
}
Expand description

Macro for importing Rust code that has been generated by capnpc::CompilerCommand.

For example:

generated_code!(pub mod foo_capnp);

pulls in the generated code for foo.capnp into a module named foo_capnp. It expects to find the generated code in a file $OUT_DIR/foo_capnp.rs, where OUT_DIR is Cargo’s standard environment variable giving the location of the output of build.rs.

If the generated code lives in a nonstandard location—perhaps in a subdirectory of OUT_DIR—you can specify its path as a second argument:

generated_code!(pub mod foo_capnp, "some_directory/foo_capnp.rs");