zerocopy

Trait Immutable

Source
pub unsafe trait Immutable { }
Expand description

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.:

#[derive(Immutable)]
struct MyStruct {
    ...
}

#[derive(Immutable)]
enum MyEnum {
    ...
}

#[derive(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.

Implementations on Foreign Types§

Source§

impl Immutable for bool

Source§

impl Immutable for char

Source§

impl Immutable for f32

Source§

impl Immutable for f64

Source§

impl Immutable for i8

Source§

impl Immutable for i16

Source§

impl Immutable for i32

Source§

impl Immutable for i64

Source§

impl Immutable for i128

Source§

impl Immutable for isize

Source§

impl Immutable for str

Source§

impl Immutable for u8

Source§

impl Immutable for u16

Source§

impl Immutable for u32

Source§

impl Immutable for u64

Source§

impl Immutable for u128

Source§

impl Immutable for ()

Source§

impl Immutable for usize

Source§

impl Immutable for NonZeroI8

Source§

impl Immutable for NonZeroI16

Source§

impl Immutable for NonZeroI32

Source§

impl Immutable for NonZeroI64

Source§

impl Immutable for NonZeroI128

Source§

impl Immutable for NonZeroIsize

Source§

impl Immutable for NonZeroU8

Source§

impl Immutable for NonZeroU16

Source§

impl Immutable for NonZeroU32

Source§

impl Immutable for NonZeroU64

Source§

impl Immutable for NonZeroU128

Source§

impl Immutable for NonZeroUsize

Source§

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>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

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>

Source§

impl<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: B, _: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

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>

Source§

impl<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: C, _: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

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>

Source§

impl<D, E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: D, _: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<E, F, G, H, I, J, K, L, M> Immutable for Option<fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: E, _: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<F, G, H, I, J, K, L, M> Immutable for Option<fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: F, _: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<G, H, I, J, K, L, M> Immutable for Option<fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: G, _: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<H, I, J, K, L, M> Immutable for Option<fn(_: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: H, _: I, _: J, _: K, _: L) -> M>

Source§

impl<I, J, K, L, M> Immutable for Option<fn(_: I, _: J, _: K, _: L) -> M>

Source§

impl<I, J, K, L, M> Immutable for Option<extern "C" fn(_: I, _: J, _: K, _: L) -> M>

Source§

impl<J, K, L, M> Immutable for Option<fn(_: J, _: K, _: L) -> M>

Source§

impl<J, K, L, M> Immutable for Option<extern "C" fn(_: J, _: K, _: L) -> M>

Source§

impl<K, L, M> Immutable for Option<fn(_: K, _: L) -> M>

Source§

impl<K, L, M> Immutable for Option<extern "C" fn(_: K, _: L) -> M>

Source§

impl<L, M> Immutable for Option<fn(_: L) -> M>

Source§

impl<L, M> Immutable for Option<extern "C" fn(_: L) -> M>

Source§

impl<M> Immutable for Option<fn() -> M>

Source§

impl<M> Immutable for Option<extern "C" fn() -> M>

Source§

impl<T: Immutable> Immutable for Option<T>

Source§

impl<T: Immutable> Immutable for [T]

Source§

impl<T: Immutable> Immutable for Wrapping<T>

Source§

impl<T: Immutable> Immutable for MaybeUninit<T>

Source§

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

Source§

impl<T: ?Sized + Immutable> Immutable for ManuallyDrop<T>

Source§

impl<T: ?Sized> Immutable for *const T

Source§

impl<T: ?Sized> Immutable for *mut T

Source§

impl<T: ?Sized> Immutable for &T

Source§

impl<T: ?Sized> Immutable for &mut T

Source§

impl<T: ?Sized> Immutable for PhantomData<T>

Source§

impl<T: ?Sized> Immutable for NonNull<T>

Implementors§

Source§

impl<O> Immutable for F32<O>

Source§

impl<O> Immutable for F64<O>

Source§

impl<O> Immutable for I16<O>

Source§

impl<O> Immutable for I32<O>

Source§

impl<O> Immutable for I64<O>

Source§

impl<O> Immutable for I128<O>

Source§

impl<O> Immutable for Isize<O>

Source§

impl<O> Immutable for U16<O>

Source§

impl<O> Immutable for U32<O>

Source§

impl<O> Immutable for U64<O>

Source§

impl<O> Immutable for U128<O>

Source§

impl<O> Immutable for Usize<O>

Source§

impl<T: Immutable> Immutable for Unalign<T>