Lesson 48 of 50
rustProcedural Macros Overview
15 minutes
Course progress96%
Procedural Macros Overview
Procedural macros let you generate Rust code at compile time. There are three kinds: #[derive], attribute macros, and function‑like macros.
# Cargo.toml for the macro crate
[lib]
proc-macro = true
extern crate proc_macro;
proc_macro::TokenStream;
(input: TokenStream) TokenStream {
input
}