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 NonZero<i8>

Source§

impl Immutable for NonZero<i16>

Source§

impl Immutable for NonZero<i32>

Source§

impl Immutable for NonZero<i64>

Source§

impl Immutable for NonZero<i128>

Source§

impl Immutable for NonZero<isize>

Source§

impl Immutable for NonZero<u8>

Source§

impl Immutable for NonZero<u16>

Source§

impl Immutable for NonZero<u32>

Source§

impl Immutable for NonZero<u64>

Source§

impl Immutable for NonZero<u128>

Source§

impl Immutable for NonZero<usize>

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 for Option<T>
where T: Immutable,

Source§

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

Source§

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

Source§

impl<T> Immutable for &T
where T: ?Sized,

Source§

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

Source§

impl<T> Immutable for [T]
where T: Immutable,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§

Source§

impl Immutable for s2n_codec::zerocopy::I16

Source§

impl Immutable for s2n_codec::zerocopy::I32

Source§

impl Immutable for s2n_codec::zerocopy::I64

Source§

impl Immutable for s2n_codec::zerocopy::I128

Source§

impl Immutable for s2n_codec::zerocopy::U16

Source§

impl Immutable for s2n_codec::zerocopy::U32

Source§

impl Immutable for s2n_codec::zerocopy::U64

Source§

impl Immutable for s2n_codec::zerocopy::U128

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::I16<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::I32<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::I64<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::I128<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::U16<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::U32<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::U64<O>

Source§

impl<O> Immutable for s2n_codec::zerocopy::byteorder::U128<O>

Source§

impl<O> Immutable for F32<O>

Source§

impl<O> Immutable for F64<O>

Source§

impl<O> Immutable for Isize<O>

Source§

impl<O> Immutable for Usize<O>

Source§

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