[][src]Macro static_assertions::assert_eq_size_val

macro_rules! assert_eq_size_val {
    ($x:expr, $($xs:expr),+ $(,)?) => { ... };

Asserts that values are equal in size.

This macro doesn't consume its arguments and thus works for non-Cloneable values.


struct Byte(u8);

let x = 10u8;
let y = Byte(42); // Works for non-cloneable types

assert_eq_size_val!(x, y);
assert_eq_size_val!(x, y, 0u8);

Even though both values are 0, they are of types with different sizes:

This example deliberately fails to compile
assert_eq_size_val!(0u8, 0u32);