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.

1 Like