|
| 1 | +/* automatically generated by rust-bindgen */ |
| 2 | + |
| 3 | + |
| 4 | +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] |
| 5 | + |
| 6 | + |
| 7 | +#[repr(C)] |
| 8 | +#[derive(Debug, Default, Copy, Hash, PartialEq)] |
| 9 | +pub struct Doggo { |
| 10 | + pub x: ::std::os::raw::c_int, |
| 11 | +} |
| 12 | +#[test] |
| 13 | +fn bindgen_test_layout_Doggo() { |
| 14 | + assert_eq!(::std::mem::size_of::<Doggo>() , 4usize , concat ! ( |
| 15 | + "Size of: " , stringify ! ( Doggo ) )); |
| 16 | + assert_eq! (::std::mem::align_of::<Doggo>() , 4usize , concat ! ( |
| 17 | + "Alignment of " , stringify ! ( Doggo ) )); |
| 18 | + assert_eq! (unsafe { |
| 19 | + & ( * ( 0 as * const Doggo ) ) . x as * const _ as usize } , |
| 20 | + 0usize , concat ! ( |
| 21 | + "Alignment of field: " , stringify ! ( Doggo ) , "::" , |
| 22 | + stringify ! ( x ) )); |
| 23 | +} |
| 24 | +impl Clone for Doggo { |
| 25 | + fn clone(&self) -> Self { *self } |
| 26 | +} |
| 27 | +#[repr(C)] |
| 28 | +#[derive(Debug, Default, Copy, Hash, PartialEq)] |
| 29 | +pub struct Null { |
| 30 | + pub _address: u8, |
| 31 | +} |
| 32 | +#[test] |
| 33 | +fn bindgen_test_layout_Null() { |
| 34 | + assert_eq!(::std::mem::size_of::<Null>() , 1usize , concat ! ( |
| 35 | + "Size of: " , stringify ! ( Null ) )); |
| 36 | + assert_eq! (::std::mem::align_of::<Null>() , 1usize , concat ! ( |
| 37 | + "Alignment of " , stringify ! ( Null ) )); |
| 38 | +} |
| 39 | +impl Clone for Null { |
| 40 | + fn clone(&self) -> Self { *self } |
| 41 | +} |
| 42 | +/// This type is an opaque union. Unions can't derive anything interesting like |
| 43 | +/// Debug or Default, even if their layout can, because it would require knowing |
| 44 | +/// which variant is in use. Opaque unions still end up as a `union` in the Rust |
| 45 | +/// bindings, but they just have one variant. Even so, can't derive. We should |
| 46 | +/// probably emit an opaque struct for opaque unions... but until then, we have |
| 47 | +/// this test to make sure that opaque unions don't derive and still compile. |
| 48 | +#[repr(C)] |
| 49 | +#[derive(Copy)] |
| 50 | +pub union DoggoOrNull { |
| 51 | + pub _bindgen_opaque_blob: u32, |
| 52 | +} |
| 53 | +#[test] |
| 54 | +fn bindgen_test_layout_DoggoOrNull() { |
| 55 | + assert_eq!(::std::mem::size_of::<DoggoOrNull>() , 4usize , concat ! ( |
| 56 | + "Size of: " , stringify ! ( DoggoOrNull ) )); |
| 57 | + assert_eq! (::std::mem::align_of::<DoggoOrNull>() , 4usize , concat ! ( |
| 58 | + "Alignment of " , stringify ! ( DoggoOrNull ) )); |
| 59 | +} |
| 60 | +impl Clone for DoggoOrNull { |
| 61 | + fn clone(&self) -> Self { *self } |
| 62 | +} |
| 63 | +impl Default for DoggoOrNull { |
| 64 | + fn default() -> Self { unsafe { ::std::mem::zeroed() } } |
| 65 | +} |
0 commit comments