Procedural Macros in Rust - Tips, Tricks, and Usage
Offered By: Rust via YouTube
Course Description
Overview
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
Related Courses
The Rust Programming LanguageUdemy Rust for Beginners: Learn Rust in 4 Hours
Udemy Rust For Undergrads
Udemy Take your first steps with Rust
Microsoft via Microsoft Learn Rust Fundamentals
Pluralsight