| #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] |
| pub const foo_THIS: foo = 0; |
| pub const foo_SHOULD_BE: foo = 1; |
| pub const foo_A_CONSTANT: foo = 2; |
| pub type foo = ::std::os::raw::c_uint; |
| #[repr(C)] |
| #[derive(Debug, Copy, Clone)] |
| pub struct bar { |
| pub this_should_work: foo, |
| } |
| #[test] |
| fn bindgen_test_layout_bar() { |
| const UNINIT: ::std::mem::MaybeUninit<bar> = ::std::mem::MaybeUninit::uninit(); |
| let ptr = UNINIT.as_ptr(); |
| assert_eq!( |
| ::std::mem::size_of::<bar>(), |
| 4usize, |
| concat!("Size of: ", stringify!(bar)), |
| ); |
| assert_eq!( |
| ::std::mem::align_of::<bar>(), |
| 4usize, |
| concat!("Alignment of ", stringify!(bar)), |
| ); |
| assert_eq!( |
| unsafe { ::std::ptr::addr_of!((*ptr).this_should_work) as usize - ptr as usize }, |
| 0usize, |
| concat!("Offset of field: ", stringify!(bar), "::", stringify!(this_should_work)), |
| ); |
| } |
| impl Default for bar { |
| fn default() -> Self { |
| let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); |
| unsafe { |
| ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); |
| s.assume_init() |
| } |
| } |
| } |