From 906c620d4b95735cdf7877e4e9dc51ac33276b06 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 10 Aug 2023 18:05:29 +0000 Subject: [PATCH] feat: builtin field attributes --- --- 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, } }); -- gitstuff