Trait Immutable
unsafe trait Immutable
Types which are free from interior mutability.
T: Immutable indicates that T does not permit interior mutation, except
by ownership or an exclusive (&mut) borrow.
Implementation
Do not implement this trait yourself! Instead, use
#[derive(Immutable)] (requires the derive Cargo feature);
e.g.:
# use Immutable;
union MyUnion
This derive performs a sophisticated, compile-time safety analysis to
determine whether a type is Immutable.
Safety
Unsafe code outside of this crate must not make any assumptions about T
based on T: Immutable. We reserve the right to relax the requirements for
Immutable in the future, and if unsafe code outside of this crate makes
assumptions based on T: Immutable, future relaxations may cause that code
to become unsound.
Implementors
impl<M> Immutable for Option<unsafe fn() -> M>impl<O> Immutable for Usize<O>impl Immutable for ()impl<T: ?Sized> Immutable for &Timpl<H, I, J, K, L, M> Immutable for Option<unsafe fn(_: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for u32impl Immutable for __m128iimpl<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for i128impl Immutable for __m512impl<K, L, M> Immutable for Option<extern C { unwind: false } fn(_: K, _: L) -> M>impl<O> Immutable for U64<O>impl Immutable for boolimpl<F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroU16impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroI64impl<I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: I, _: J, _: K, _: L) -> M>impl<M> Immutable for Option<fn() -> M>impl<D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<H, I, J, K, L, M> Immutable for Option<fn(_: H, _: I, _: J, _: K, _: L) -> M>impl<T: Immutable> Immutable for Wrapping<T>impl<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: ?Sized> Immutable for *const Timpl<K, L, M> Immutable for Option<unsafe fn(_: K, _: L) -> M>impl Immutable for i8impl<T: Immutable> Immutable for Option<T>impl<F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for u64impl Immutable for __m256dimpl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for isizeimpl Immutable for __m512iimpl<I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: I, _: J, _: K, _: L) -> M>impl<O> Immutable for F64<O>impl Immutable for strimpl<D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroU32impl<O> Immutable for I128<O>impl<L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: L) -> M>impl Immutable for NonZeroI128impl<G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<K, L, M> Immutable for Option<fn(_: K, _: L) -> M>impl<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<O> Immutable for U16<O>impl<F, G, H, I, J, K, L, M> Immutable for Option<fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: ?Sized + Immutable> Immutable for ManuallyDrop<T>impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: ?Sized> Immutable for NonNull<T>impl<I, J, K, L, M> Immutable for Option<unsafe fn(_: I, _: J, _: K, _: L) -> M>impl Immutable for i16impl Immutable for __m128dimpl<D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for u128impl Immutable for __m512bhimpl<L, M> Immutable for Option<extern C { unwind: false } fn(_: L) -> M>impl Immutable for f64impl<G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroI8impl<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroU64impl<J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: J, _: K, _: L) -> M>impl Immutable for NonZeroIsizeimpl<O> Immutable for U32<O>impl<E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<O> Immutable for U128<O>impl<I, J, K, L, M> Immutable for Option<fn(_: I, _: J, _: K, _: L) -> M>impl<T: ?Sized> Immutable for PhantomData<T>impl<D, E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: Immutable> Immutable for [T]impl<L, M> Immutable for Option<unsafe fn(_: L) -> M>impl Immutable for u8impl<O> Immutable for F32<O>impl<O> Immutable for I64<O>impl<T: ?Sized> Immutable for &mut Timpl<G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for i32impl Immutable for __m256impl<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for usizeimpl Immutable for __m512dimpl<J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: J, _: K, _: L) -> M>impl Immutable for charimpl<E, F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroI16impl<M> Immutable for Option<unsafe extern C { unwind: false } fn() -> M>impl Immutable for NonZeroU128impl<H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: H, _: I, _: J, _: K, _: L) -> M>impl<L, M> Immutable for Option<fn(_: L) -> M>impl<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<G, H, I, J, K, L, M> Immutable for Option<fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: Immutable> Immutable for CoreMaybeUninit<T>impl<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: ?Sized> Immutable for *mut Timpl<J, K, L, M> Immutable for Option<unsafe fn(_: J, _: K, _: L) -> M>impl Immutable for u16impl Immutable for __m128impl<E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<O> Immutable for I16<O>impl Immutable for i64impl Immutable for __m256iimpl<M> Immutable for Option<extern C { unwind: false } fn() -> M>impl<T> Immutable for Unalign<T>impl Immutable for f32impl<O> Immutable for I32<O>impl<H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroU8impl<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern C { unwind: false } fn(_: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl Immutable for NonZeroI32impl<K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: K, _: L) -> M>impl Immutable for NonZeroUsizeimpl<F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<J, K, L, M> Immutable for Option<fn(_: J, _: K, _: L) -> M>impl<O> Immutable for Isize<O>impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern C { unwind: false } fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>impl<T: Immutable, N: usize> Immutable for [T; N]