• 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 = foo__bindgen_ty_1::FOO_A;
14 pub const foo_FOO_B: foo__bindgen_ty_1 = foo__bindgen_ty_1::FOO_B;
15 #[repr(u32)]
16 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
17 pub enum foo__bindgen_ty_1 {
18     FOO_A = 0,
19     FOO_B = 1,
20 }
21 #[test]
bindgen_test_layout_foo()22 fn bindgen_test_layout_foo() {
23     const UNINIT: ::std::mem::MaybeUninit<foo> =
24         ::std::mem::MaybeUninit::uninit();
25     let ptr = UNINIT.as_ptr();
26     assert_eq!(
27         ::std::mem::size_of::<foo>(),
28         4usize,
29         concat!("Size of: ", stringify!(foo))
30     );
31     assert_eq!(
32         ::std::mem::align_of::<foo>(),
33         4usize,
34         concat!("Alignment of ", stringify!(foo))
35     );
36     assert_eq!(
37         unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize },
38         0usize,
39         concat!(
40             "Offset of field: ",
41             stringify!(foo),
42             "::",
43             stringify!(member)
44         )
45     );
46 }
47 impl Default for foo {
default() -> Self48     fn default() -> Self {
49         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
50         unsafe {
51             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
52             s.assume_init()
53         }
54     }
55 }
56 #[repr(u32)]
57 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
58 pub enum Foo {
59     Bar = 0,
60     Qux = 1,
61 }
62 pub mod Neg {
63     pub type Type = ::std::os::raw::c_int;
64     pub const MinusOne: Type = -1;
65     pub const One: Type = 1;
66 }
67 #[repr(u32)]
68 /// <div rustbindgen nodebug></div>
69 #[derive(Copy, Clone, Hash, PartialEq, Eq)]
70 pub enum NoDebug {
71     NoDebug1 = 0,
72     NoDebug2 = 1,
73 }
74 #[repr(u32)]
75 /// <div rustbindgen derive="Debug"></div>
76 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
77 pub enum Debug {
78     Debug1 = 0,
79     Debug2 = 1,
80 }
81