The macro system is stupidly powerful but I agree this isn't a decent example. C preprocessor macros are very cumbersome not only to read and write, but to use.
I alluded to this is another comment but Rust macros can call arbitrary Rust code. Including file i/o at compile time, such as loading a config file in your syntax of choice, deserializing it to a struct, and then using it to synthesize tokens. Rust's macros become an extremely powerful tool for code generation using Rust itself.
I alluded to this is another comment but Rust macros can call arbitrary Rust code. Including file i/o at compile time, such as loading a config file in your syntax of choice, deserializing it to a struct, and then using it to synthesize tokens. Rust's macros become an extremely powerful tool for code generation using Rust itself.