-
Notifications
You must be signed in to change notification settings - Fork 793
Expand file tree
/
Copy pathclass.rs
More file actions
301 lines (297 loc) · 11.5 KB
/
class.rs
File metadata and controls
301 lines (297 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>);
impl <T> __IncompleteArrayField<T> {
#[inline]
pub fn new() -> Self {
__IncompleteArrayField(::std::marker::PhantomData)
}
#[inline]
pub unsafe fn as_ptr(&self) -> *const T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut_ptr(&mut self) -> *mut T {
::std::mem::transmute(self)
}
#[inline]
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
::std::slice::from_raw_parts(self.as_ptr(), len)
}
#[inline]
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
}
}
impl <T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__IncompleteArrayField")
}
}
impl <T> ::std::clone::Clone for __IncompleteArrayField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Copy)]
pub struct C {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
}
#[test]
fn bindgen_test_layout_C() {
assert_eq!(::std::mem::size_of::<C>() , 40usize , concat ! (
"Size of: " , stringify ! ( C ) ));
assert_eq! (::std::mem::align_of::<C>() , 4usize , concat ! (
"Alignment of " , stringify ! ( C ) ));
assert_eq! (unsafe { & ( * ( 0 as * const C ) ) . a as * const _ as usize
} , 0usize , concat ! (
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
! ( a ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const C ) ) . big_array as * const _ as usize }
, 4usize , concat ! (
"Alignment of field: " , stringify ! ( C ) , "::" , stringify
! ( big_array ) ));
}
impl Clone for C {
fn clone(&self) -> Self { *self }
}
impl Default for C {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
pub struct C_with_zero_length_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array() {
assert_eq!(::std::mem::size_of::<C_with_zero_length_array>() , 40usize ,
concat ! (
"Size of: " , stringify ! ( C_with_zero_length_array ) ));
assert_eq! (::std::mem::align_of::<C_with_zero_length_array>() , 4usize ,
concat ! (
"Alignment of " , stringify ! ( C_with_zero_length_array ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const C_with_zero_length_array ) ) . a as *
const _ as usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! (
C_with_zero_length_array ) , "::" , stringify ! ( a ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const C_with_zero_length_array ) ) . big_array
as * const _ as usize } , 4usize , concat ! (
"Alignment of field: " , stringify ! (
C_with_zero_length_array ) , "::" , stringify ! ( big_array )
));
assert_eq! (unsafe {
& ( * ( 0 as * const C_with_zero_length_array ) ) .
zero_length_array as * const _ as usize } , 37usize , concat !
(
"Alignment of field: " , stringify ! (
C_with_zero_length_array ) , "::" , stringify ! (
zero_length_array ) ));
}
impl Default for C_with_zero_length_array {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
pub struct C_with_incomplete_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array() {
assert_eq!(::std::mem::size_of::<C_with_incomplete_array>() , 40usize ,
concat ! (
"Size of: " , stringify ! ( C_with_incomplete_array ) ));
assert_eq! (::std::mem::align_of::<C_with_incomplete_array>() , 4usize ,
concat ! (
"Alignment of " , stringify ! ( C_with_incomplete_array ) ));
}
impl Default for C_with_incomplete_array {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
pub struct C_with_zero_length_array_and_incomplete_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
assert_eq!(::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>()
, 40usize , concat ! (
"Size of: " , stringify ! (
C_with_zero_length_array_and_incomplete_array ) ));
assert_eq! (::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array>()
, 4usize , concat ! (
"Alignment of " , stringify ! (
C_with_zero_length_array_and_incomplete_array ) ));
}
impl Default for C_with_zero_length_array_and_incomplete_array {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default)]
pub struct WithDtor {
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_WithDtor() {
assert_eq!(::std::mem::size_of::<WithDtor>() , 4usize , concat ! (
"Size of: " , stringify ! ( WithDtor ) ));
assert_eq! (::std::mem::align_of::<WithDtor>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithDtor ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const WithDtor ) ) . b as * const _ as usize }
, 0usize , concat ! (
"Alignment of field: " , stringify ! ( WithDtor ) , "::" ,
stringify ! ( b ) ));
}
#[repr(C)]
pub struct IncompleteArrayNonCopiable {
pub whatever: *mut ::std::os::raw::c_void,
pub incomplete_array: __IncompleteArrayField<C>,
}
#[test]
fn bindgen_test_layout_IncompleteArrayNonCopiable() {
assert_eq!(::std::mem::size_of::<IncompleteArrayNonCopiable>() , 8usize ,
concat ! (
"Size of: " , stringify ! ( IncompleteArrayNonCopiable ) ));
assert_eq! (::std::mem::align_of::<IncompleteArrayNonCopiable>() , 8usize
, concat ! (
"Alignment of " , stringify ! ( IncompleteArrayNonCopiable )
));
}
impl Default for IncompleteArrayNonCopiable {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct Union {
pub d: __BindgenUnionField<f32>,
pub i: __BindgenUnionField<::std::os::raw::c_int>,
pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_Union() {
assert_eq!(::std::mem::size_of::<Union>() , 4usize , concat ! (
"Size of: " , stringify ! ( Union ) ));
assert_eq! (::std::mem::align_of::<Union>() , 4usize , concat ! (
"Alignment of " , stringify ! ( Union ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const Union ) ) . d as * const _ as usize } ,
0usize , concat ! (
"Alignment of field: " , stringify ! ( Union ) , "::" ,
stringify ! ( d ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const Union ) ) . i as * const _ as usize } ,
0usize , concat ! (
"Alignment of field: " , stringify ! ( Union ) , "::" ,
stringify ! ( i ) ));
}
impl Clone for Union {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct WithUnion {
pub data: Union,
}
#[test]
fn bindgen_test_layout_WithUnion() {
assert_eq!(::std::mem::size_of::<WithUnion>() , 4usize , concat ! (
"Size of: " , stringify ! ( WithUnion ) ));
assert_eq! (::std::mem::align_of::<WithUnion>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithUnion ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const WithUnion ) ) . data as * const _ as
usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! ( WithUnion ) , "::" ,
stringify ! ( data ) ));
}
impl Clone for WithUnion {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct RealAbstractionWithTonsOfMethods {
pub _address: u8,
}
#[test]
fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
assert_eq!(::std::mem::size_of::<RealAbstractionWithTonsOfMethods>() ,
1usize , concat ! (
"Size of: " , stringify ! ( RealAbstractionWithTonsOfMethods )
));
assert_eq! (::std::mem::align_of::<RealAbstractionWithTonsOfMethods>() ,
1usize , concat ! (
"Alignment of " , stringify ! (
RealAbstractionWithTonsOfMethods ) ));
}
extern "C" {
#[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"]
pub fn RealAbstractionWithTonsOfMethods_bar(this:
*const RealAbstractionWithTonsOfMethods);
}
extern "C" {
#[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"]
pub fn RealAbstractionWithTonsOfMethods_bar1(this:
*mut RealAbstractionWithTonsOfMethods);
}
extern "C" {
#[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"]
pub fn RealAbstractionWithTonsOfMethods_bar2(this:
*mut RealAbstractionWithTonsOfMethods,
foo: ::std::os::raw::c_int);
}
extern "C" {
#[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"]
pub fn RealAbstractionWithTonsOfMethods_sta();
}
impl Clone for RealAbstractionWithTonsOfMethods {
fn clone(&self) -> Self { *self }
}
impl RealAbstractionWithTonsOfMethods {
#[inline]
pub unsafe fn bar(&self) { RealAbstractionWithTonsOfMethods_bar(self) }
#[inline]
pub unsafe fn bar1(&mut self) {
RealAbstractionWithTonsOfMethods_bar1(self)
}
#[inline]
pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) {
RealAbstractionWithTonsOfMethods_bar2(self, foo)
}
#[inline]
pub unsafe fn sta() { RealAbstractionWithTonsOfMethods_sta() }
}