• 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(Debug, Copy, Clone)]
10 pub struct foo {
11     pub member: foo__bindgen_ty_1,
12 }
13 pub const foo_FOO_A: foo__bindgen_ty_1 = 0;
14 pub const foo_FOO_B: foo__bindgen_ty_1 = 1;
15 pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint;
16 #[test]
bindgen_test_layout_foo()17 fn bindgen_test_layout_foo() {
18     const UNINIT: ::std::mem::MaybeUninit<foo> =
19         ::std::mem::MaybeUninit::uninit();
20     let ptr = UNINIT.as_ptr();
21     assert_eq!(
22         ::std::mem::size_of::<foo>(),
23         4usize,
24         concat!("Size of: ", stringify!(foo))
25     );
26     assert_eq!(
27         ::std::mem::align_of::<foo>(),
28         4usize,
29         concat!("Alignment of ", stringify!(foo))
30     );
31     assert_eq!(
32         unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize },
33         0usize,
34         concat!(
35             "Offset of field: ",
36             stringify!(foo),
37             "::",
38             stringify!(member)
39         )
40     );
41 }
42 impl Default for foo {
default() -> Self43     fn default() -> Self {
44         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
45         unsafe {
46             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
47             s.assume_init()
48         }
49     }
50 }
51 pub const Foo_Bar: Foo = 0;
52 pub const Foo_Qux: Foo = 1;
53 pub type Foo = ::std::os::raw::c_uint;
54 pub const Neg_MinusOne: Neg = -1;
55 pub const Neg_One: Neg = 1;
56 pub type Neg = ::std::os::raw::c_int;
57 pub const NoDebug_NoDebug1: NoDebug = 0;
58 pub const NoDebug_NoDebug2: NoDebug = 1;
59 /// <div rustbindgen nodebug></div>
60 pub type NoDebug = ::std::os::raw::c_uint;
61 pub const Debug_Debug1: Debug = 0;
62 pub const Debug_Debug2: Debug = 1;
63 /// <div rustbindgen derive="Debug"></div>
64 pub type Debug = ::std::os::raw::c_uint;
65