https://build.rs/ is a handy Rust pattern for compile-time code generation. E.g. https://rust-lang-nursery.github.io/rust-bindgen/tutorial-3.html
It's a small standalone program that prints lines of Rust code! It reminds me of much more dynamic languages.