You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// You can see that every time I interpolate types I need to define an extra variable//and then clone itfnautomap(n:usize) -> TokenStream2{let types = (1..=n).map(|n| format_ident!("T{}", n));let types2 = types.clone();let fields = (1..=n).map(|n| format_ident!("map{}", n));quote!{pubstructAutoMap<#(#types),*> {
#( #fields:BaseMap<#types2> ),*}}}
//I want to define an additional gen_types function and then call it when interpolatingfnautomap(n:usize) -> TokenStream2{let fields = (1..=n).map(|n| format_ident!("map{}", n));quote!{//`#gen_types(n)` call the `gen_types(n)` and insert the resultpubstructAutoMap<#gen_types(n)> {
#( #fields:BaseMap<#gen_types(n)> ),*}}}fngen_types(n:usize) -> TokenStream2{let i = (1..=n).map(|n| format_ident!("T{}", n));quote!{ #(#i),*}}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: