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

Asserts that values are equal in size.

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

Examples

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:

assert_eq_size_val!(0u8, 0u32);