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 {
1567
1567
let accessor_kind =
1568
1568
self . annotations ( ) . accessor_kind ( ) . unwrap_or ( accessor_kind) ;
1569
1569
1570
+ let attributes: Vec < proc_macro2:: TokenStream > = self . annotations ( )
1571
+ . attributes ( )
1572
+ . iter ( )
1573
+ . map ( |s| s. parse ( ) . unwrap ( ) ) . collect :: < Vec < _ > > ( ) ;
1574
+
1570
1575
match visibility {
1571
1576
FieldVisibilityKind :: Private => {
1572
1577
field. append_all ( quote ! {
1578
+ #( #attributes ) *
1573
1579
#field_ident : #ty ,
1574
1580
} ) ;
1575
1581
}
1576
1582
FieldVisibilityKind :: PublicCrate => {
1577
1583
field. append_all ( quote ! {
1584
+ #( #attributes ) *
1578
1585
pub ( crate ) #field_ident : #ty ,
1579
1586
} ) ;
1580
1587
}
1581
1588
FieldVisibilityKind :: Public => {
1582
1589
field. append_all ( quote ! {
1590
+ #( #attributes ) *
1583
1591
pub #field_ident : #ty ,
1584
1592
} ) ;
1585
1593
}
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ pub(crate) struct Annotations {
102
102
constify_enum_variant : bool ,
103
103
/// List of explicit derives for this type.
104
104
derives : Vec < String > ,
105
- /// List of explicit attributes for this type.
105
+ /// List of explicit attributes for this type/field .
106
106
attributes : Vec < String > ,
107
107
}
108
108
You can’t perform that action at this time.
0 commit comments