memory_layout/lib.rs
1pub use memory_layout_codegen::memory_layout;
2
3#[cfg(test)]
4mod tests {
5 use core::mem::size_of;
6
7 use crate::memory_layout;
8
9 #[test]
10 fn test_size() {
11 #[memory_layout(0x38)]
12 pub struct Foo {
13 #[field_offset(0x10)]
14 pub a: i32,
15
16 #[field_offset(0x20)]
17 pub b: i32,
18
19 #[field_offset(0x30)]
20 pub c: i32
21 }
22
23 assert_eq!(size_of::<Foo>(), 0x38, "`Foo` should be 0x38 bytes in size")
24 }
25}