Go to content

Reasoning about Rust: an introduction to Rustdoc's JSON format - Luca Palmieri

Macros are the primary mechanism for metaprogramming in Rust, either to perform code generation or enforce constraints at compile-time that are not easily captured by the type system (e.g. sqlx). Macros are also limited: their input is a stream of tokens, with no type-level information. Up until last year, you had to hook directly into the compiler internals to get a more featureful representation. This is no longer the case, thanks to Rustdoc's JSON format: an information-rich representation of your Rust API in a machine-parsable format (with a versioned schema!). We will introduce the feature, look at the structure of the data and cover a few of the usecases where it shines. You will leave the talk with a basic understanding of the format and ideas on how you could leverage it to build tools that enhance your own Rust workflows. 🦀 *About Luca Palmieri* 🦀 Luca Palmieri (https://twitter.com/algo_luca) builds technology products for a living. His current focus is on backend development, software architecture and the Rust programming language. He currently works at MainMatter as a Principal Engineering Consultant. He partners with teams across the industry to make sure they succeed in adopting or scaling their Rust usage, where it makes sense to do so. He was formerly at AWS and TrueLayer. He has been part of the Rust community since 2018 and is best known as the author of “Zero to Production in Rust”, an introduction to using Rust for backend development. When he is not coding, you’ll find him baking cakes or rolling pasta sheets.

October 10, 2023