@@ -36,31 +36,70 @@ macro_rules! __cfg_if_apply {
36
36
37
37
macro_rules! s {
38
38
( $( $( #[ $attr: meta] ) * pub $t: ident $i: ident { $( $field: tt) * } ) * ) => ( $(
39
+ s!( it: $( #[ $attr] ) * pub $t $i { $( $field) * } ) ;
40
+ ) * ) ;
41
+ ( it: $( #[ $attr: meta] ) * pub union $i: ident { $( $field: tt) * } ) => (
42
+ cfg_if! {
43
+ if #[ cfg( libc_union) ] {
44
+ __item! {
45
+ #[ repr( C ) ]
46
+ #[ cfg_attr( feature = "extra_traits" , derive( Debug , Eq , Hash , PartialEq ) ) ]
47
+ $( #[ $attr] ) *
48
+ pub union $i { $( $field) * }
49
+ }
50
+
51
+ impl :: dox:: Copy for $i { }
52
+ impl :: dox:: Clone for $i {
53
+ fn clone( & self ) -> $i { * self }
54
+ }
55
+ }
56
+ }
57
+ ) ;
58
+ ( it: $( #[ $attr: meta] ) * pub struct $i: ident { $( $field: tt) * } ) => (
39
59
__item! {
40
60
#[ repr( C ) ]
41
- $( #[ $attr] ) *
42
61
#[ cfg_attr( feature = "extra_traits" , derive( Debug , Eq , Hash , PartialEq ) ) ]
43
- pub $t $i { $( $field) * }
62
+ $( #[ $attr] ) *
63
+ pub struct $i { $( $field) * }
44
64
}
45
65
impl :: dox:: Copy for $i { }
46
66
impl :: dox:: Clone for $i {
47
67
fn clone( & self ) -> $i { * self }
48
68
}
49
- ) * )
69
+ ) ;
50
70
}
51
71
52
72
macro_rules! s_no_extra_traits {
53
73
( $( $( #[ $attr: meta] ) * pub $t: ident $i: ident { $( $field: tt) * } ) * ) => ( $(
74
+ s!( it: $( #[ $attr] ) * pub $t $i { $( $field) * } ) ;
75
+ ) * ) ;
76
+ ( it: $( #[ $attr: meta] ) * pub union $i: ident { $( $field: tt) * } ) => (
77
+ cfg_if! {
78
+ if #[ cfg( libc_union) ] {
79
+ __item! {
80
+ #[ repr( C ) ]
81
+ $( #[ $attr] ) *
82
+ pub union $i { $( $field) * }
83
+ }
84
+
85
+ impl :: dox:: Copy for $i { }
86
+ impl :: dox:: Clone for $i {
87
+ fn clone( & self ) -> $i { * self }
88
+ }
89
+ }
90
+ }
91
+ ) ;
92
+ ( it: $( #[ $attr: meta] ) * pub struct $i: ident { $( $field: tt) * } ) => (
54
93
__item! {
55
94
#[ repr( C ) ]
56
95
$( #[ $attr] ) *
57
- pub $t $i { $( $field) * }
96
+ pub struct $i { $( $field) * }
58
97
}
59
98
impl :: dox:: Copy for $i { }
60
99
impl :: dox:: Clone for $i {
61
100
fn clone( & self ) -> $i { * self }
62
101
}
63
- ) * )
102
+ ) ;
64
103
}
65
104
66
105
#[ allow( unused_macros) ]
0 commit comments