Hello everybody, first post here.
I've been trying to find some extense macro documentation for dummies but I am not finding a thing, I've checked the little book of macros and the updated version lacks a practical chapter, if you know any source of learning macros please feel free to comment it
Thanks for reading!
Is this the practical section from the old book? I took quick look through, but it's pretty dense for something calling itself an introduction.
The first places to check are the official help docs, Rust By Example and the Rust Book, but while the Rust by Example pages are pretty good the book barely addresses declarative macros and jumps right to procedural macros. They are sexier, but it's a bit intense!
Doing some googling, there's a cloudflare blog that's a pretty good progressive, practical, and short introduction, though I'll say that if you actually do start doing this "tt munching" in real code, you should probably be using a procedural macro, it's generally less painful.
Lastly, macros are so technical and different to the rest of Rust in how they work you should always keep the reference handy - there's a lot of weird stuff about follow sets, hygiene and scoping that you're going to run into at the worst time.
@marc0 - Hi there. I'd been looking for some procedural macro documentation, tutorials, and code examples too, and it has been difficult to find them.
syn crate has a nice codelab, w/ examples, but outside of that (and reading
quote create docs) I wasn't really able to find very much.
So, I wrote my own, and I hope this helps:
I've also written other tutorials that are on Rust like async/await, async traits, topics on concurrency and parallelism, etc. You can find them all here: Rust | developerlife.com
For declarative macros, I recommend this resource: The Little Book of Rust Macros
Have fun on your Rust journey!
Wow, thanks a lot @simonbuchan @nazmulidris, I will definitely check those out