Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Discover the power of procedural macros in Rust through this conference talk from RustLatam 2019. Explore how "macros 1.2" on stable Rust opens up new possibilities for developers. Learn about derive macros and their impact on popular crates like Serde, and delve into attribute macros for lightweight annotations in frameworks. Gain insights into the proc-macro crate type, TokenStream, and Token Tree concepts. Understand modularized macros, parsing with syn, expanding with quote, and working with Span and Hygiene. Get tips on using the Diagnostics API and debugging macros. Conclude with a gallery of procedural macro examples and a Q&A session to deepen your understanding of this powerful Rust feature.
Syllabus
Intro
Rise of Procedural Macros
Rise of Sliced Bread
The proc-macro crate type
println! (...)
TokenStream?
Token Tree? enun Token Tree Group (Group) Ident (Ident)
Modularized Macros
Parsing with syn
Expanding with quote
Interpolation in quote
Working with Span
Hygiene
Diagnostics API
Debugging Macros
Procedural Macro Gallery
Questions?
Taught by
Rust