check_same_layout

Macro check_same_layout 

Source
macro_rules! check_same_layout {
    {} => { ... };
    {
        $type_name1:ty = $type_name2:ty
        {
            $(
                $($field1:ident).+ => $($field2:ident).+
            ),*
            $(,)?
        }
        $($token:tt)*
    } => { ... };
}
Expand description

Ensure 2 different types have the same layout.

Usage:

check_same_layout! {
    Type1 = Type2 {
        type1_field1 => type2_field1,
        type1_field2 => type2_field2,
        ...
    }
}