Skip to content

Instantly share code, notes, and snippets.

@gabrielfalcao
Created June 19, 2026 10:14
Show Gist options
  • Select an option

  • Save gabrielfalcao/ae5be0304dd2c9ef919a2e34c0b55cfd to your computer and use it in GitHub Desktop.

Select an option

Save gabrielfalcao/ae5be0304dd2c9ef919a2e34c0b55cfd to your computer and use it in GitHub Desktop.
rust macro designators

Rust macro_rules! Designators

  • expr: Any valid Rust expression (e.g., 2 + 2, func()).
  • ident: An identifier, such as function names or variable names.
  • ty: A Rust data type (e.g., i32, Vec<String>).
  • path: A qualified path (e.g., std::collections::HashMap).
  • stmt: A single statement.
  • block: A block of code surrounded by curly braces {}.
  • literal: A literal value (e.g., "hello", 42, true).
  • tt: A single token tree (the most flexible, matches almost anything).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment