Macro zerocopy::macros::unsafe_impl_known_layout

source ·
macro_rules! unsafe_impl_known_layout {
    ($($tyvar:ident: ?Sized + KnownLayout =>)? #[repr($repr:ty)] $ty:ty) => { ... };
}
Expand description

Implements KnownLayout for a type in terms of the implementation of another type with the same representation.

§Safety

  • $ty and $repr must have the same:
    • Fixed prefix size
    • Alignment
    • (For DSTs) trailing slice element size
  • It must be valid to perform an as cast from *mut $repr to *mut $ty, and this operation must preserve referent size (ie, size_of_val_raw).