Getting identifier value from syn::Ident?

I have a procedural macro where I use the syn crate to parse the token stream. As far as I can see the Ident type in syn does not have a value method, like LitStr::value or LitChar::value, so I'm not sure how to get the value of an identifier after parsing it. Is it possible?

A string representation of the ident is available through the to_string() method.

https://docs.rs/syn/1.0.69/syn/struct.Ident.html#examples

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.