Expand description
§include_tt
Macros for ultra-flexible injection of token trees, literals, or binary data into Rust syntax trees from external sources.
This crate allows you to compose file paths dynamically and include their content as tokens, strings, or byte arrays directly into your source code.
use include_tt::inject;
use std::fmt::Write;
let mut buf = String::new();
inject! {
write!(
&mut buf,
"Welcome, {}. Your score is {}!",
#tt("examples/name.tt"), // `"Ferris"`
#tt("examples/" "score" ".tt") // `100500`
).unwrap();
}
assert_eq!(buf, "Welcome, Ferris. Your score is 100500!");Macros§
- inject
- Ultra-flexible macro for compile-time injection of token trees, strings, or byte arrays from files.