Skip to content

Instantly share code, notes, and snippets.

@ayazhafiz
Created April 6, 2022 14:32
Show Gist options
  • Save ayazhafiz/f4e5404b51ed6e7235b9ad32b9711f98 to your computer and use it in GitHub Desktop.
Save ayazhafiz/f4e5404b51ed6e7235b9ad32b9711f98 to your computer and use it in GitHub Desktop.
/* automatically generated by rust-bindgen 0.59.2 */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rgba {
pub a: f32,
pub b: f32,
pub c: f32,
pub d: f32,
}
#[test]
fn bindgen_test_layout_rgba() {
assert_eq!(
::std::mem::size_of::<rgba>(),
16usize,
concat!("Size of: ", stringify!(rgba))
);
assert_eq!(
::std::mem::align_of::<rgba>(),
4usize,
concat!("Alignment of ", stringify!(rgba))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rgba>())).a as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(rgba), "::", stringify!(a))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rgba>())).b as *const _ as usize },
4usize,
concat!("Offset of field: ", stringify!(rgba), "::", stringify!(b))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rgba>())).c as *const _ as usize },
8usize,
concat!("Offset of field: ", stringify!(rgba), "::", stringify!(c))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rgba>())).d as *const _ as usize },
12usize,
concat!("Offset of field: ", stringify!(rgba), "::", stringify!(d))
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct styles {
pub a: rgba,
pub b: rgba,
pub c: f32,
pub d: rgba,
}
#[test]
fn bindgen_test_layout_styles() {
assert_eq!(
::std::mem::size_of::<styles>(),
52usize,
concat!("Size of: ", stringify!(styles))
);
assert_eq!(
::std::mem::align_of::<styles>(),
4usize,
concat!("Alignment of ", stringify!(styles))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<styles>())).a as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(styles), "::", stringify!(a))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<styles>())).b as *const _ as usize },
16usize,
concat!("Offset of field: ", stringify!(styles), "::", stringify!(b))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<styles>())).c as *const _ as usize },
32usize,
concat!("Offset of field: ", stringify!(styles), "::", stringify!(c))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<styles>())).d as *const _ as usize },
36usize,
concat!("Offset of field: ", stringify!(styles), "::", stringify!(d))
);
}
#[repr(C)]
#[repr(align(16))]
#[derive(Copy, Clone)]
pub union RocElemEntry {
pub a: styles,
pub b: RocElemEntry___uint128_t,
}
#[test]
fn bindgen_test_layout_RocElemEntry() {
assert_eq!(
::std::mem::size_of::<RocElemEntry>(),
64usize,
concat!("Size of: ", stringify!(RocElemEntry))
);
assert_eq!(
::std::mem::align_of::<RocElemEntry>(),
16usize,
concat!("Alignment of ", stringify!(RocElemEntry))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<RocElemEntry>())).a as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RocElemEntry),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<RocElemEntry>())).b as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(RocElemEntry),
"::",
stringify!(b)
)
);
}
pub type RocElemEntry___uint128_t = u128;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment