git.delta.rocks / jrsonnet / refs/commits / 906c620d4b95

difftreelog

feat builtin field attributes

Yaroslav Bolyukin2023-08-10parent: #8a6eedd.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth
69}69}
7070
71struct Field {71struct Field {
72 attrs: Vec<Attribute>,
72 name: Ident,73 name: Ident,
73 _colon: Token![:],74 _colon: Token![:],
74 ty: Type,75 ty: Type,
75}76}
76impl Parse for Field {77impl Parse for Field {
77 fn parse(input: ParseStream) -> syn::Result<Self> {78 fn parse(input: ParseStream) -> syn::Result<Self> {
78 Ok(Self {79 Ok(Self {
80 attrs: input.call(Attribute::parse_outer)?,
79 name: input.parse()?,81 name: input.parse()?,
80 _colon: input.parse()?,82 _colon: input.parse()?,
81 ty: input.parse()?,83 ty: input.parse()?,
314 });316 });
315317
316 let fields = attr.fields.iter().map(|field| {318 let fields = attr.fields.iter().map(|field| {
319 let attrs = &field.attrs;
317 let name = &field.name;320 let name = &field.name;
318 let ty = &field.ty;321 let ty = &field.ty;
319 quote! {322 quote! {
323 #(#attrs)*
320 pub #name: #ty,324 pub #name: #ty,
321 }325 }
322 });326 });