pub const fn align_of_val<T: ?Sized>(val: &T) -> usizeExpand description
Returns the ABI-required minimum alignment of the type of the value that val points to, in
bytes.
This function is identical to align_of::<T>() whenever T: Sized,
but also supports determining the alignment required by a dyn Trait value, which is the
alignment of the underlying concrete type.
§Examples
(Caution: it is not guaranteed that the alignment of i32 is 4;
that is, this example assertion does not pass on all platforms.)
dyn types may have different alignments for different values;
align_of_val can be used to learn those alignments: