Hacker News new | ask | show | jobs
by steveklabnik 2563 days ago
Procedural macros take a list of tokens, and you give a list of tokens back, and they're then compiled.

https://doc.rust-lang.org/stable/book/ch19-06-macros.html#ho... (starts with derive, then moves on to attributes. Function-like ones aren't stable yet)

1 comments

Thanks, that's similar, also I would argue that for inexperienced developer just producing desired text would be a simpler solution (but dangerous).
If you use the `quote` crate[1], it's pretty much identical in terms of developer experience.

[1] https://github.com/dtolnay/quote