#Using fields of values in `quote`

2 messages · Page 1 of 1 (latest)

quartz vapor
#

Hey everyone,

I'm working on implementing a derive macro, and one of the things I need to do is use the repetition syntax. However, the items in my iterator have fields which I need to access seperately. This is what I tried:
#(counter += Trait::trait_function::<#fields.ty>(&self.#fields.ident.unwrap())?);*
However, I cannot figure out how to access fields directly in the quote! block. How do I do this?

glacial robin
#

You can't; you have to assign them to separate variables, which in this case means unzip()ing the iterator