Macro Rules

  • Rust provides a powerful macro system that allows metaprogramming

  • Macros look like functions, except that their name ends with a bang !

  • Instead of generating a function call, macros are expanded into source code that gets compiled with the rest of the program

  • Unlike macros in C, Rust macros are expanded into abstract syntax trees, rather than string preprocessing