Easy way to modify a `syn` AST?

I'm wondering whether there is a nice way to generate syn types for my procmacro? Constructing them seems to be very painful, and it would be lovely if I could just parse them out of rust code. e.g. I'm wanting a GenericArgument, but it requires creating a whole lot of nested structs.

Is there any easier way to construct a syn AST? I'm sure I'm not the first to want to do AST manipulation...

1 Like

Are you looking for syn::parse_quote!? It does the translation at runtime, but it takes contents of the macro invocation and parses it into a syn tree.

1 Like

That looks like exactly what I'm looking for! I'll hopefully be able to try it out tomorrow.