dtolnay / quote

Rust quasi-quoting
Apache License 2.0
1.32k stars 90 forks source link

Array indexes ? #233

Closed alkeryn closed 1 year ago

alkeryn commented 1 year ago

would it be possible to access array indexes ? if i want to do something like that for example :

 for i in 0..#first.len() {
     vec.push(format!(#fmt,#ast[i]));
 }

also ast's defined like this :

let parser = Punctuated::<syn::Expr, syn::Token![,]>::parse_separated_nonempty;
let ast = parser.parse(input).unwrap();

within a quote, as of right now, it doesn't do the desired behavior. any idea ?

also calling fuctions like #ast.len(), wouldn't give the lenght for each expression if they are strings for example, but it'll give each expression, then the lenght of the last one.

dtolnay commented 1 year ago

I would prefer not to support this proposal in this crate.