Skip to main content

const_assert_pod

Macro const_assert_pod 

Source
macro_rules! const_assert_pod {
    ($ty:ty, $size:expr) => { ... };
}
Expand description

Compile-time assertion for safe manual Pod implementations.

Verifies that a type meets all Pod requirements:

  • align_of == 1 (required for zero-copy overlay at any offset)
  • size_of == SIZE matches declared SIZE

Use this when implementing Pod manually (outside of hopper_layout!).

#[repr(C)]
#[derive(Clone, Copy)]
pub struct MyEntry {
    pub key: [u8; 32],
    pub value: WireU64,
}

const_assert_pod!(MyEntry, 40);
unsafe impl Pod for MyEntry {}