|
| 1 | +/* automatically generated by rust-bindgen */ |
| 2 | + |
| 3 | +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] |
| 4 | + |
| 5 | +#[repr(C)] |
| 6 | +#[derive(Debug, Default, Copy, Clone)] |
| 7 | +pub struct bar { |
| 8 | + pub u: foo, |
| 9 | +} |
| 10 | +#[repr(C)] |
| 11 | +#[derive(Debug, Default, Copy, Clone)] |
| 12 | +pub struct foo { |
| 13 | + pub foo: ::std::os::raw::c_int, |
| 14 | +} |
| 15 | +#[test] |
| 16 | +fn bindgen_test_layout_foo() { |
| 17 | + assert_eq!( |
| 18 | + ::std::mem::size_of::<foo>(), |
| 19 | + 4usize, |
| 20 | + concat!("Size of: ", stringify!(foo)) |
| 21 | + ); |
| 22 | + assert_eq!( |
| 23 | + ::std::mem::align_of::<foo>(), |
| 24 | + 4usize, |
| 25 | + concat!("Alignment of ", stringify!(foo)) |
| 26 | + ); |
| 27 | + assert_eq!( |
| 28 | + unsafe { &(*(::std::ptr::null::<foo>())).foo as *const _ as usize }, |
| 29 | + 0usize, |
| 30 | + concat!("Offset of field: ", stringify!(foo), "::", stringify!(foo)) |
| 31 | + ); |
| 32 | +} |
| 33 | +#[test] |
| 34 | +fn bindgen_test_layout_bar() { |
| 35 | + assert_eq!( |
| 36 | + ::std::mem::size_of::<bar>(), |
| 37 | + 4usize, |
| 38 | + concat!("Size of: ", stringify!(bar)) |
| 39 | + ); |
| 40 | + assert_eq!( |
| 41 | + ::std::mem::align_of::<bar>(), |
| 42 | + 4usize, |
| 43 | + concat!("Alignment of ", stringify!(bar)) |
| 44 | + ); |
| 45 | + assert_eq!( |
| 46 | + unsafe { &(*(::std::ptr::null::<bar>())).u as *const _ as usize }, |
| 47 | + 0usize, |
| 48 | + concat!("Offset of field: ", stringify!(bar), "::", stringify!(u)) |
| 49 | + ); |
| 50 | +} |
| 51 | +pub type bar_t = bar; |
| 52 | +#[repr(C)] |
| 53 | +#[derive(Debug, Default, Copy, Clone)] |
| 54 | +pub struct baz { |
| 55 | + pub f: foo, |
| 56 | +} |
| 57 | +#[test] |
| 58 | +fn bindgen_test_layout_baz() { |
| 59 | + assert_eq!( |
| 60 | + ::std::mem::size_of::<baz>(), |
| 61 | + 4usize, |
| 62 | + concat!("Size of: ", stringify!(baz)) |
| 63 | + ); |
| 64 | + assert_eq!( |
| 65 | + ::std::mem::align_of::<baz>(), |
| 66 | + 4usize, |
| 67 | + concat!("Alignment of ", stringify!(baz)) |
| 68 | + ); |
| 69 | + assert_eq!( |
| 70 | + unsafe { &(*(::std::ptr::null::<baz>())).f as *const _ as usize }, |
| 71 | + 0usize, |
| 72 | + concat!("Offset of field: ", stringify!(baz), "::", stringify!(f)) |
| 73 | + ); |
| 74 | +} |
0 commit comments