File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ struct S {
2+ /// <div rustbindgen attribute="#[Attr1] #[Attr2]" attribute="#[Attr3(value)]"></div>
3+ int field_1 ;
4+ char field_2 ;
5+ };
Original file line number Diff line number Diff line change @@ -1567,19 +1567,29 @@ impl FieldCodegen<'_> for FieldData {
15671567 let accessor_kind =
15681568 self . annotations ( ) . accessor_kind ( ) . unwrap_or ( accessor_kind) ;
15691569
1570+ let attributes: Vec < proc_macro2:: TokenStream > = self
1571+ . annotations ( )
1572+ . attributes ( )
1573+ . iter ( )
1574+ . map ( |s| s. parse ( ) . unwrap ( ) )
1575+ . collect :: < Vec < _ > > ( ) ;
1576+
15701577 match visibility {
15711578 FieldVisibilityKind :: Private => {
15721579 field. append_all ( quote ! {
1580+ #( #attributes ) *
15731581 #field_ident : #ty ,
15741582 } ) ;
15751583 }
15761584 FieldVisibilityKind :: PublicCrate => {
15771585 field. append_all ( quote ! {
1586+ #( #attributes ) *
15781587 pub ( crate ) #field_ident : #ty ,
15791588 } ) ;
15801589 }
15811590 FieldVisibilityKind :: Public => {
15821591 field. append_all ( quote ! {
1592+ #( #attributes ) *
15831593 pub #field_ident : #ty ,
15841594 } ) ;
15851595 }
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ pub(crate) struct Annotations {
102102 constify_enum_variant : bool ,
103103 /// List of explicit derives for this type.
104104 derives : Vec < String > ,
105- /// List of explicit attributes for this type.
105+ /// List of explicit attributes for this type/field .
106106 attributes : Vec < String > ,
107107}
108108
You can’t perform that action at this time.
0 commit comments