union_padding

Macro union_padding 

Source
macro_rules! union_padding {
    ($t:ty, [$($ts:ty),*]) => { ... };
}
Expand description

Does the union type $t have padding?

$ts is the list of the type of every field in $t. $t must be a union type, or else union_padding!’s result may be meaningless.

Note that union_padding!’s results are independent of repr since they only consider the size of the type and the sizes of the fields. Whatever the repr, the size of the type already takes into account any padding that the compiler has decided to add. Unions with well-defined representations (such as repr(C)) can use this macro to check for padding. Note that while this may yield some consistent value for some repr(Rust) unions, it is not guaranteed across platforms or compilations.