Skip to main content

One post tagged with "macro"

View All Tags

Rust Macros

· 4 min read
forfd8960
Author

What is a Rust Macro?

  • Core Concept: Macros are a way of writing code that writes other code, a form of metaprogramming.
  • Compile-Time Expansion: Unlike functions (which are called at runtime), macros are expanded during compilation. The Rust compiler replaces a macro invocation with the code generated by the macro before compiling the rest of the code.