I’m trying to write a proc_macro that automatically implement a trait for a struct. The trait is as follows
trait StructName {
fn name(&self) -> &'static str;
}
However, I found it hard to escape quote mark in the quote macro, for example, the following code is not working
let self_ty: Box<syn::Type> = ...;
quote!(
impl StructName for #self_ty {
fn name(&self) -> &'static str {
"#self_ty"
}
}
)
How to escape quote mark in the quote macro?