Trait Unaligned
unsafe trait Unaligned
Types with no alignment requirement.
If T: Unaligned, then align_of::<T>() == 1.
Implementation
Do not implement this trait yourself! Instead, use
#[derive(Unaligned)]; e.g.:
# use Unaligned;
union MyUnion
This derive performs a sophisticated, compile-time safety analysis to
determine whether a type is Unaligned.
Safety
This section describes what is required in order for T: Unaligned, and
what unsafe code may assume of such types. If you don't plan on implementing
Unaligned manually, and you don't plan on writing unsafe code that
operates on Unaligned types, then you don't need to read this section.
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.
#[derive(Unaligned)] only permits types which satisfy these
requirements.
Implementors
impl<O> Unaligned for Usize<O>impl<O> Unaligned for U64<O>impl Unaligned for strimpl Unaligned for AtomicBoolimpl<T: Unaligned> Unaligned for CoreMaybeUninit<T>impl<T: Unaligned> Unaligned for [T]impl<O> Unaligned for F64<O>impl Unaligned for u8impl<O> Unaligned for I128<O>impl Unaligned for NonZeroI8impl Unaligned for AtomicI8impl<T: ?Sized + Unaligned> Unaligned for Cell<T>impl Unaligned for boolimpl Unaligned for Option<NonZeroI8>impl<O> Unaligned for U32<O>impl<T: Unaligned> Unaligned for Wrapping<T>impl<O> Unaligned for U128<O>impl<T: Unaligned, N: usize> Unaligned for [T; N]impl<O> Unaligned for F32<O>impl<O> Unaligned for I64<O>impl Unaligned for ()impl Unaligned for NonZeroU8impl Unaligned for AtomicU8impl<T: ?Sized + Unaligned> Unaligned for ManuallyDrop<T>impl<O> Unaligned for U16<O>impl<O> Unaligned for I16<O>impl<T> Unaligned for Unalign<T>impl<O> Unaligned for I32<O>impl Unaligned for i8impl Unaligned for Option<NonZeroU8>impl<T: ?Sized> Unaligned for PhantomData<T>impl<O> Unaligned for Isize<O>impl<T: ?Sized + Unaligned> Unaligned for UnsafeCell<T>