1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub use memory_layout_codegen::memory_layout;

#[cfg(test)]
mod tests {
  use core::mem::size_of;

  use crate::memory_layout;

  #[test]
  fn test_size() {
    #[memory_layout(0x38)]
    pub struct Foo {
      #[field_offset(0x10)]
      pub a: i32,

      #[field_offset(0x20)]
      pub b: i32,

      #[field_offset(0x30)]
      pub c: i32
    }

    assert_eq!(size_of::<Foo>(), 0x38, "`Foo` should be 0x38 bytes long")
  }
}