HACKER Q&A
📣 recvonline

What's the best resource to understand Macros in Rust?


I read the "Little Book of Macros"[1] but still have a hard time applying the knowledge to create my own easily, or to read other Macros and know what they are doing.

Does anyone have a secret blog post or tip to understand and learn Macros in Rust?

[1]: https://veykril.github.io/tlborm/introduction.html


  👤 lazypenguin Accepted Answer ✓
I also struggled with this, the best thing I found is to look at other people’s macros. I would look at a macro that I know what it does, look at the source then try to understand the concepts used by referring to other material.

I wrote a blog post about it a while ago but not sure if it’s a useful resource or not: https://www.ralphminderhoud.com/blog/simple-struct-macro/