I'm having issues finding how to use variables in parse_quote
in the documentation.
I have a string variable that I need to insert into a turbofish statement I create with parse_quote
.
Below are my attempts after reading some documentation and this question.
let my_var = String::from("hello");
let stmt = syn::parse_quote! { handle.add_class<#(my_var)::#(my_var)>(); };
This fails to compile with a warning about expecting other keywords.
I've also tried the following based on the documentation for parse_quote
.
let my_var = quote!("hello");
let stmt = syn::parse_quote! { handle.add_class<#(my_var)::#(my_var)>(); };
This throws a similar error to the one above.