Rust theorytheory 0/50 · 0%
Metaprogramming · medium

36. Macros

macro_rules! and derive macros.

Declarative macros written with `macro_rules!` match token patterns and expand code, reducing boilerplate. Procedural macros — derive, attribute and function-like — run Rust code at compile time over token streams and power frameworks like Anchor.

Check your understanding

  1. 1. Which macro kind runs code at compile time on tokens?

  2. 2. Anchor's #[program] is a…