valence/include_generated.rs
1//! Host helpers for including `valence-codegen` build artifacts.
2
3/// Include `$OUT_DIR/generated_models.rs` produced by `valence_codegen::build`.
4///
5/// Expands to a `generated` module plus `pub use generated::*`. Invoke once at
6/// crate root (or another module that should re-export models):
7///
8/// ```ignore
9/// valence::include_generated_models!();
10/// ```
11///
12/// Schema DSL files under `schemas/` are scan inputs for codegen; they are not
13/// linked via `mod`. The generated module must be linked into the binary so
14/// `inventory` registrations are visible.
15#[macro_export]
16macro_rules! include_generated_models {
17 () => {
18 pub mod generated {
19 #![allow(
20 dead_code,
21 unused_imports,
22 clippy::uninlined_format_args,
23 clippy::single_match_else,
24 clippy::unnecessary_trailing_comma,
25 clippy::unused_async,
26 clippy::elidable_lifetime_names
27 )]
28 include!(concat!(env!("OUT_DIR"), "/generated_models.rs"));
29 }
30 pub use generated::*;
31 };
32}