--- a/crates/jrsonnet-macros/src/lib.rs +++ b/crates/jrsonnet-macros/src/lib.rs @@ -69,6 +69,7 @@ } struct Field { + attrs: Vec, name: Ident, _colon: Token![:], ty: Type, @@ -76,6 +77,7 @@ impl Parse for Field { fn parse(input: ParseStream) -> syn::Result { Ok(Self { + attrs: input.call(Attribute::parse_outer)?, name: input.parse()?, _colon: input.parse()?, ty: input.parse()?, @@ -314,9 +316,11 @@ }); let fields = attr.fields.iter().map(|field| { + let attrs = &field.attrs; let name = &field.name; let ty = &field.ty; quote! { + #(#attrs)* pub #name: #ty, } });