File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Expand file tree Collapse file tree 4 files changed +32
-1
lines changed 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,27 @@ 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 . annotations ( )
1571+ . attributes ( )
1572+ . iter ( )
1573+ . map ( |s| s. parse ( ) . unwrap ( ) ) . collect :: < Vec < _ > > ( ) ;
1574+
15701575 match visibility {
15711576 FieldVisibilityKind :: Private => {
15721577 field. append_all ( quote ! {
1578+ #( #attributes ) *
15731579 #field_ident : #ty ,
15741580 } ) ;
15751581 }
15761582 FieldVisibilityKind :: PublicCrate => {
15771583 field. append_all ( quote ! {
1584+ #( #attributes ) *
15781585 pub ( crate ) #field_ident : #ty ,
15791586 } ) ;
15801587 }
15811588 FieldVisibilityKind :: Public => {
15821589 field. append_all ( quote ! {
1590+ #( #attributes ) *
15831591 pub #field_ident : #ty ,
15841592 } ) ;
15851593 }
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