~/talk

Procedural Macros 101

name:Ciara R
links:none on file
slides:none on file

Shows how to view and reason about real expanded Rust code with cargo expand and IDE expansion, then walks through building a proc-macro crate that parses token streams with syn and quote to generate trait impls and constructors. Demonstrates deriving Clone-style impls, a derive constructor that creates new(...) from struct fields, and HTML-like function macros that accept non-Rust tokens. Covers spans for accurate errors and testing with trybuild, plus maintenance and hygiene pitfalls.

AI-written summary Β· about

  1. 0:00Introduction
  2. 1:48Procedural macros and metaprogramming
  3. 3:13Three types of macros
  4. 4:39Derive macros with clone
  5. 6:01Why use Rust macros
  6. 7:04Custom syntax extension
  7. 8:11Token stream manipulation
  8. 9:54Token streams and spans
  9. 11:20Write your first macro
  10. 12:24Derive macro to print AST
  11. 14:31Implementing trait with derive
  12. 15:53Code from struct fields
  13. 17:19Automatic constructor macro
  14. 20:28Macro writing considerations
  15. 21:30Learning resources
  16. 23:17Closing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark β€” the status bar button does the same
?
this help
esc
close this, then clear every filter β€” or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.