Trait zerocopy::Unaligned

source ·
pub unsafe trait Unaligned { }
Expand description

Types with no alignment requirement.

WARNING: Do not implement this trait yourself! Instead, use #[derive(Unaligned)].

If T: Unaligned, then align_of::<T>() == 1.

Safety

If T: Unaligned, then unsafe code may assume that it is sound to produce a reference to T at any memory location regardless of alignment. If a type is marked as Unaligned which violates this contract, it may cause undefined behavior.

Implementations on Foreign Types§

source§

impl Unaligned for i8

source§

impl Unaligned for u8

source§

impl Unaligned for ()

source§

impl<T> Unaligned for PhantomData<T>

source§

impl<T: Unaligned> Unaligned for [T]

source§

impl<T: Unaligned, const N: usize> Unaligned for [T; N]

Implementors§