Skip to main content

assert_not_size

Function assert_not_size 

Source
pub const fn assert_not_size<T, const SIZE: usize>()
Expand description

Assert that the size of T does not match SIZE at compile time.

ยงUsage

#[repr(C)]
struct Fred {
    foo: u32,
    bar: u64,
    baz: bool,
}
// If the type were not `C` layout, and were instead `Rust`
// layout, the size would end up being 16 instead of 24, and
// this check would fail.
const _: () = isit::assert_not_size::<Fred, 16>();