I am trying to get into proc macro development,
but I'm having difficulties finding up to date recourses.
Is there a list (something like arewegameyet) of recommendet recourses?
I would recommend:
- https://github.com/dtolnay/syn/blob/master/README.md
- https://github.com/dtolnay/syn/tree/master/examples
- Procedural Macros - The Rust Reference
If anything is not up to date, please file issues.
2 Likes
The 3rd link you provide has this text:
Procedural macro crates almost always will link to the compiler-provided proc_macro crate.
This raises a question: what about the proc_macro2
crate?
Is that a temporary artifact that will go away once the new macro
-keyword based system is stable?
And if so, how exactly does one deal with the fallout from proc_macro2
going away?
I now have a question myself: How can I deal with proc_macro2
's Literal
type?
There are no operations defined for it, almost all its methods return a Literal instance.
What I want to accomplish is get the information stored within the literal as a string.
I've already answered my own question: just use format!("{}", lit)
if lit
is the name of the Literal
, then strip the surrounding quotation marks.