Rust Macro

Noun · Development

Definitions

  1. A metaprogramming construct in Rust that generates code at compile time. Declarative macros (macro_rules!) match patterns and expand to code, while procedural macros operate on the token stream to implement custom derives, attributes, and function-like macros — enabling boilerplate elimination without runtime cost.

    In plain English: A Rust feature that automatically writes repetitive code for you during compilation, so you don't have to do it by hand.

    Example: "The #[derive(Serialize, Deserialize)] proc macro auto-generates all the serde impls at compile time so we never hand-write JSON conversion code."

Related Terms