• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(
2     dead_code,
3     non_snake_case,
4     non_camel_case_types,
5     non_upper_case_globals
6 )]
7 
8 #[repr(C)]
9 #[derive(Default)]
10 pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
11 impl<T> __IncompleteArrayField<T> {
12     #[inline]
new() -> Self13     pub fn new() -> Self {
14         __IncompleteArrayField(::std::marker::PhantomData, [])
15     }
16     #[inline]
as_ptr(&self) -> *const T17     pub fn as_ptr(&self) -> *const T {
18         self as *const _ as *const T
19     }
20     #[inline]
as_mut_ptr(&mut self) -> *mut T21     pub fn as_mut_ptr(&mut self) -> *mut T {
22         self as *mut _ as *mut T
23     }
24     #[inline]
as_slice(&self, len: usize) -> &[T]25     pub unsafe fn as_slice(&self, len: usize) -> &[T] {
26         ::std::slice::from_raw_parts(self.as_ptr(), len)
27     }
28     #[inline]
as_mut_slice(&mut self, len: usize) -> &mut [T]29     pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
30         ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
31     }
32 }
33 impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result34     fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
35         fmt.write_str("__IncompleteArrayField")
36     }
37 }
38 #[repr(C)]
39 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
40 impl<T> __BindgenUnionField<T> {
41     #[inline]
new() -> Self42     pub fn new() -> Self {
43         __BindgenUnionField(::std::marker::PhantomData)
44     }
45     #[inline]
as_ref(&self) -> &T46     pub unsafe fn as_ref(&self) -> &T {
47         ::std::mem::transmute(self)
48     }
49     #[inline]
as_mut(&mut self) -> &mut T50     pub unsafe fn as_mut(&mut self) -> &mut T {
51         ::std::mem::transmute(self)
52     }
53 }
54 impl<T> ::std::default::Default for __BindgenUnionField<T> {
55     #[inline]
default() -> Self56     fn default() -> Self {
57         Self::new()
58     }
59 }
60 impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
61     #[inline]
clone(&self) -> Self62     fn clone(&self) -> Self {
63         Self::new()
64     }
65 }
66 impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
67 impl<T> ::std::fmt::Debug for __BindgenUnionField<T> {
fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result68     fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
69         fmt.write_str("__BindgenUnionField")
70     }
71 }
72 impl<T> ::std::hash::Hash for __BindgenUnionField<T> {
hash<H: ::std::hash::Hasher>(&self, _state: &mut H)73     fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) {}
74 }
75 impl<T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
eq(&self, _other: &__BindgenUnionField<T>) -> bool76     fn eq(&self, _other: &__BindgenUnionField<T>) -> bool {
77         true
78     }
79 }
80 impl<T> ::std::cmp::Eq for __BindgenUnionField<T> {}
81 #[repr(C)]
82 #[derive(Copy)]
83 pub struct C {
84     pub a: ::std::os::raw::c_int,
85     pub big_array: [::std::os::raw::c_char; 33usize],
86 }
87 #[test]
bindgen_test_layout_C()88 fn bindgen_test_layout_C() {
89     const UNINIT: ::std::mem::MaybeUninit<C> =
90         ::std::mem::MaybeUninit::uninit();
91     let ptr = UNINIT.as_ptr();
92     assert_eq!(
93         ::std::mem::size_of::<C>(),
94         40usize,
95         concat!("Size of: ", stringify!(C))
96     );
97     assert_eq!(
98         ::std::mem::align_of::<C>(),
99         4usize,
100         concat!("Alignment of ", stringify!(C))
101     );
102     assert_eq!(
103         unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
104         0usize,
105         concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
106     );
107     assert_eq!(
108         unsafe {
109             ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
110         },
111         4usize,
112         concat!(
113             "Offset of field: ",
114             stringify!(C),
115             "::",
116             stringify!(big_array)
117         )
118     );
119 }
120 impl Clone for C {
clone(&self) -> Self121     fn clone(&self) -> Self {
122         *self
123     }
124 }
125 impl Default for C {
default() -> Self126     fn default() -> Self {
127         unsafe {
128             let mut s: Self = ::std::mem::uninitialized();
129             ::std::ptr::write_bytes(&mut s, 0, 1);
130             s
131         }
132     }
133 }
134 impl ::std::cmp::PartialEq for C {
eq(&self, other: &C) -> bool135     fn eq(&self, other: &C) -> bool {
136         self.a == other.a && &self.big_array[..] == &other.big_array[..]
137     }
138 }
139 #[repr(C)]
140 pub struct C_with_zero_length_array {
141     pub a: ::std::os::raw::c_int,
142     pub big_array: [::std::os::raw::c_char; 33usize],
143     pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
144 }
145 #[test]
bindgen_test_layout_C_with_zero_length_array()146 fn bindgen_test_layout_C_with_zero_length_array() {
147     const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> =
148         ::std::mem::MaybeUninit::uninit();
149     let ptr = UNINIT.as_ptr();
150     assert_eq!(
151         ::std::mem::size_of::<C_with_zero_length_array>(),
152         40usize,
153         concat!("Size of: ", stringify!(C_with_zero_length_array))
154     );
155     assert_eq!(
156         ::std::mem::align_of::<C_with_zero_length_array>(),
157         4usize,
158         concat!("Alignment of ", stringify!(C_with_zero_length_array))
159     );
160     assert_eq!(
161         unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
162         0usize,
163         concat!(
164             "Offset of field: ",
165             stringify!(C_with_zero_length_array),
166             "::",
167             stringify!(a)
168         )
169     );
170     assert_eq!(
171         unsafe {
172             ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
173         },
174         4usize,
175         concat!(
176             "Offset of field: ",
177             stringify!(C_with_zero_length_array),
178             "::",
179             stringify!(big_array)
180         )
181     );
182     assert_eq!(
183         unsafe {
184             ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
185                 ptr as usize
186         },
187         37usize,
188         concat!(
189             "Offset of field: ",
190             stringify!(C_with_zero_length_array),
191             "::",
192             stringify!(zero_length_array)
193         )
194     );
195 }
196 impl Default for C_with_zero_length_array {
default() -> Self197     fn default() -> Self {
198         unsafe {
199             let mut s: Self = ::std::mem::uninitialized();
200             ::std::ptr::write_bytes(&mut s, 0, 1);
201             s
202         }
203     }
204 }
205 #[repr(C)]
206 #[derive(Debug, Default)]
207 pub struct C_with_zero_length_array_2 {
208     pub a: ::std::os::raw::c_int,
209     pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
210 }
211 #[test]
bindgen_test_layout_C_with_zero_length_array_2()212 fn bindgen_test_layout_C_with_zero_length_array_2() {
213     const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> =
214         ::std::mem::MaybeUninit::uninit();
215     let ptr = UNINIT.as_ptr();
216     assert_eq!(
217         ::std::mem::size_of::<C_with_zero_length_array_2>(),
218         4usize,
219         concat!("Size of: ", stringify!(C_with_zero_length_array_2))
220     );
221     assert_eq!(
222         ::std::mem::align_of::<C_with_zero_length_array_2>(),
223         4usize,
224         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
225     );
226     assert_eq!(
227         unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
228         0usize,
229         concat!(
230             "Offset of field: ",
231             stringify!(C_with_zero_length_array_2),
232             "::",
233             stringify!(a)
234         )
235     );
236     assert_eq!(
237         unsafe {
238             ::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
239                 ptr as usize
240         },
241         4usize,
242         concat!(
243             "Offset of field: ",
244             stringify!(C_with_zero_length_array_2),
245             "::",
246             stringify!(zero_length_array)
247         )
248     );
249 }
250 #[repr(C)]
251 pub struct C_with_incomplete_array {
252     pub a: ::std::os::raw::c_int,
253     pub big_array: [::std::os::raw::c_char; 33usize],
254     pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
255 }
256 #[test]
bindgen_test_layout_C_with_incomplete_array()257 fn bindgen_test_layout_C_with_incomplete_array() {
258     assert_eq!(
259         ::std::mem::size_of::<C_with_incomplete_array>(),
260         40usize,
261         concat!("Size of: ", stringify!(C_with_incomplete_array))
262     );
263     assert_eq!(
264         ::std::mem::align_of::<C_with_incomplete_array>(),
265         4usize,
266         concat!("Alignment of ", stringify!(C_with_incomplete_array))
267     );
268 }
269 impl Default for C_with_incomplete_array {
default() -> Self270     fn default() -> Self {
271         unsafe {
272             let mut s: Self = ::std::mem::uninitialized();
273             ::std::ptr::write_bytes(&mut s, 0, 1);
274             s
275         }
276     }
277 }
278 #[repr(C)]
279 #[derive(Debug, Default)]
280 pub struct C_with_incomplete_array_2 {
281     pub a: ::std::os::raw::c_int,
282     pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
283 }
284 #[test]
bindgen_test_layout_C_with_incomplete_array_2()285 fn bindgen_test_layout_C_with_incomplete_array_2() {
286     assert_eq!(
287         ::std::mem::size_of::<C_with_incomplete_array_2>(),
288         4usize,
289         concat!("Size of: ", stringify!(C_with_incomplete_array_2))
290     );
291     assert_eq!(
292         ::std::mem::align_of::<C_with_incomplete_array_2>(),
293         4usize,
294         concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
295     );
296 }
297 #[repr(C)]
298 pub struct C_with_zero_length_array_and_incomplete_array {
299     pub a: ::std::os::raw::c_int,
300     pub big_array: [::std::os::raw::c_char; 33usize],
301     pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
302     pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
303 }
304 #[test]
bindgen_test_layout_C_with_zero_length_array_and_incomplete_array()305 fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
306     assert_eq!(
307         ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>(),
308         40usize,
309         concat!(
310             "Size of: ",
311             stringify!(C_with_zero_length_array_and_incomplete_array)
312         )
313     );
314     assert_eq!(
315         ::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array>(),
316         4usize,
317         concat!(
318             "Alignment of ",
319             stringify!(C_with_zero_length_array_and_incomplete_array)
320         )
321     );
322 }
323 impl Default for C_with_zero_length_array_and_incomplete_array {
default() -> Self324     fn default() -> Self {
325         unsafe {
326             let mut s: Self = ::std::mem::uninitialized();
327             ::std::ptr::write_bytes(&mut s, 0, 1);
328             s
329         }
330     }
331 }
332 #[repr(C)]
333 #[derive(Debug, Default)]
334 pub struct C_with_zero_length_array_and_incomplete_array_2 {
335     pub a: ::std::os::raw::c_int,
336     pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
337     pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
338 }
339 #[test]
bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2()340 fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() {
341     assert_eq!(
342         ::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>(
343         ),
344         4usize,
345         concat!(
346             "Size of: ",
347             stringify!(C_with_zero_length_array_and_incomplete_array_2)
348         )
349     );
350     assert_eq!(
351         ::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array_2>(
352         ),
353         4usize,
354         concat!(
355             "Alignment of ",
356             stringify!(C_with_zero_length_array_and_incomplete_array_2)
357         )
358     );
359 }
360 #[repr(C)]
361 #[derive(Debug, Default, Hash, PartialEq, Eq)]
362 pub struct WithDtor {
363     pub b: ::std::os::raw::c_int,
364 }
365 #[test]
bindgen_test_layout_WithDtor()366 fn bindgen_test_layout_WithDtor() {
367     const UNINIT: ::std::mem::MaybeUninit<WithDtor> =
368         ::std::mem::MaybeUninit::uninit();
369     let ptr = UNINIT.as_ptr();
370     assert_eq!(
371         ::std::mem::size_of::<WithDtor>(),
372         4usize,
373         concat!("Size of: ", stringify!(WithDtor))
374     );
375     assert_eq!(
376         ::std::mem::align_of::<WithDtor>(),
377         4usize,
378         concat!("Alignment of ", stringify!(WithDtor))
379     );
380     assert_eq!(
381         unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
382         0usize,
383         concat!(
384             "Offset of field: ",
385             stringify!(WithDtor),
386             "::",
387             stringify!(b)
388         )
389     );
390 }
391 #[repr(C)]
392 pub struct IncompleteArrayNonCopiable {
393     pub whatever: *mut ::std::os::raw::c_void,
394     pub incomplete_array: __IncompleteArrayField<C>,
395 }
396 #[test]
bindgen_test_layout_IncompleteArrayNonCopiable()397 fn bindgen_test_layout_IncompleteArrayNonCopiable() {
398     assert_eq!(
399         ::std::mem::size_of::<IncompleteArrayNonCopiable>(),
400         8usize,
401         concat!("Size of: ", stringify!(IncompleteArrayNonCopiable))
402     );
403     assert_eq!(
404         ::std::mem::align_of::<IncompleteArrayNonCopiable>(),
405         8usize,
406         concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
407     );
408 }
409 impl Default for IncompleteArrayNonCopiable {
default() -> Self410     fn default() -> Self {
411         unsafe {
412             let mut s: Self = ::std::mem::uninitialized();
413             ::std::ptr::write_bytes(&mut s, 0, 1);
414             s
415         }
416     }
417 }
418 #[repr(C)]
419 #[derive(Debug, Default, Copy, Hash, PartialEq)]
420 pub struct Union {
421     pub d: __BindgenUnionField<f32>,
422     pub i: __BindgenUnionField<::std::os::raw::c_int>,
423     pub bindgen_union_field: u32,
424 }
425 #[test]
bindgen_test_layout_Union()426 fn bindgen_test_layout_Union() {
427     const UNINIT: ::std::mem::MaybeUninit<Union> =
428         ::std::mem::MaybeUninit::uninit();
429     let ptr = UNINIT.as_ptr();
430     assert_eq!(
431         ::std::mem::size_of::<Union>(),
432         4usize,
433         concat!("Size of: ", stringify!(Union))
434     );
435     assert_eq!(
436         ::std::mem::align_of::<Union>(),
437         4usize,
438         concat!("Alignment of ", stringify!(Union))
439     );
440     assert_eq!(
441         unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
442         0usize,
443         concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
444     );
445     assert_eq!(
446         unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize },
447         0usize,
448         concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
449     );
450 }
451 impl Clone for Union {
clone(&self) -> Self452     fn clone(&self) -> Self {
453         *self
454     }
455 }
456 #[repr(C)]
457 #[derive(Debug, Default, Copy, Hash, PartialEq)]
458 pub struct WithUnion {
459     pub data: Union,
460 }
461 #[test]
bindgen_test_layout_WithUnion()462 fn bindgen_test_layout_WithUnion() {
463     const UNINIT: ::std::mem::MaybeUninit<WithUnion> =
464         ::std::mem::MaybeUninit::uninit();
465     let ptr = UNINIT.as_ptr();
466     assert_eq!(
467         ::std::mem::size_of::<WithUnion>(),
468         4usize,
469         concat!("Size of: ", stringify!(WithUnion))
470     );
471     assert_eq!(
472         ::std::mem::align_of::<WithUnion>(),
473         4usize,
474         concat!("Alignment of ", stringify!(WithUnion))
475     );
476     assert_eq!(
477         unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
478         0usize,
479         concat!(
480             "Offset of field: ",
481             stringify!(WithUnion),
482             "::",
483             stringify!(data)
484         )
485     );
486 }
487 impl Clone for WithUnion {
clone(&self) -> Self488     fn clone(&self) -> Self {
489         *self
490     }
491 }
492 #[repr(C)]
493 #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
494 pub struct RealAbstractionWithTonsOfMethods {
495     pub _address: u8,
496 }
497 #[test]
bindgen_test_layout_RealAbstractionWithTonsOfMethods()498 fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
499     assert_eq!(
500         ::std::mem::size_of::<RealAbstractionWithTonsOfMethods>(),
501         1usize,
502         concat!("Size of: ", stringify!(RealAbstractionWithTonsOfMethods))
503     );
504     assert_eq!(
505         ::std::mem::align_of::<RealAbstractionWithTonsOfMethods>(),
506         1usize,
507         concat!(
508             "Alignment of ",
509             stringify!(RealAbstractionWithTonsOfMethods)
510         )
511     );
512 }
513 extern "C" {
514     #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"]
RealAbstractionWithTonsOfMethods_bar( this: *const RealAbstractionWithTonsOfMethods, )515     pub fn RealAbstractionWithTonsOfMethods_bar(
516         this: *const RealAbstractionWithTonsOfMethods,
517     );
518 }
519 extern "C" {
520     #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"]
RealAbstractionWithTonsOfMethods_bar1( this: *mut RealAbstractionWithTonsOfMethods, )521     pub fn RealAbstractionWithTonsOfMethods_bar1(
522         this: *mut RealAbstractionWithTonsOfMethods,
523     );
524 }
525 extern "C" {
526     #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"]
RealAbstractionWithTonsOfMethods_bar2( this: *mut RealAbstractionWithTonsOfMethods, foo: ::std::os::raw::c_int, )527     pub fn RealAbstractionWithTonsOfMethods_bar2(
528         this: *mut RealAbstractionWithTonsOfMethods,
529         foo: ::std::os::raw::c_int,
530     );
531 }
532 extern "C" {
533     #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"]
RealAbstractionWithTonsOfMethods_sta()534     pub fn RealAbstractionWithTonsOfMethods_sta();
535 }
536 impl Clone for RealAbstractionWithTonsOfMethods {
clone(&self) -> Self537     fn clone(&self) -> Self {
538         *self
539     }
540 }
541 impl RealAbstractionWithTonsOfMethods {
542     #[inline]
bar(&self)543     pub unsafe fn bar(&self) {
544         RealAbstractionWithTonsOfMethods_bar(self)
545     }
546     #[inline]
bar1(&mut self)547     pub unsafe fn bar1(&mut self) {
548         RealAbstractionWithTonsOfMethods_bar1(self)
549     }
550     #[inline]
bar2(&mut self, foo: ::std::os::raw::c_int)551     pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) {
552         RealAbstractionWithTonsOfMethods_bar2(self, foo)
553     }
554     #[inline]
sta()555     pub unsafe fn sta() {
556         RealAbstractionWithTonsOfMethods_sta()
557     }
558 }
559