-
proc-macro-workshop
Learn to write Rust procedural macros [Rust Latam conference, Montevideo Uruguay, March 2019]
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
You can use cargo expand to see what your code expands to: https://github.com/dtolnay/cargo-expand
It took me a while to get anything done. My mistake : I came accross the procedural macros workshop several times, and every time I dismissed it, thinking - meh I'll just hack together exactly what I need and move on. Then finally I figured there is no way around it. The builder exercise sounds boring but it covers the topic pretty well. And then I went on to the debug one and from there was able to build the proc macro I wanted.
I actually don't remember if I finished the debug one. But it was enough for me to build a derive macro with custom attributes and some argument parsing. Building is not easy and the syntax tree is complicated so it's better to use the syn crate and the token stream from proc_macro2, so at least you can debug when running unit tests. https://astexplorer.net/ can help a lot to understand what to expect from syn.