Macros
A macro rewrites syntax before the compiler sees it. macro_rules! matches patterns on the token
stream; procedural macros are functions in their own crate that produce code.
Seven articles, and the last one argues against using them.
Articles
Section titled “Articles”Nothing published in this chapter yet — all 7 articles are still to come.
Coming up (7)
- What is a declarative macro (macro_rules!)?matching syntax, not values
- How to write a macro_rules! macrofragment specifiers and repetition
- When should you reach for a macro?and the reasons to reach for anything else
- What is the difference between macros and functions?when one can do what the other cannot
- What is a procedural macro?a function that rewrites the token stream
- How to write a derive macrosyn, quote, and a crate of its own
- What are attribute macros?a proc macro wrapped around an item