Back to Developer Roadmap

Procedural Macros and Custom Derive

src/data/roadmaps/rust/content/procedural-macros--custom-derive@bkVM1OIbv4XUpY6FQb8x_.md

4.0605 B
Original Source

Procedural Macros and Custom Derive

Procedural macros operate on token streams at compile time, generating new code. Three types exist: custom derive (for #[derive(MyTrait)]), attribute-like (#[my_attr]), and function-like (my_macro!()). More powerful than declarative macros but require separate crates with special configuration.

Visit the following resources to learn more: