Skip to main content

Immutable

Trait Immutable 

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl Immutable for ()

§

impl Immutable for NonZero<i8>

§

impl Immutable for NonZero<i16>

§

impl Immutable for NonZero<i32>

§

impl Immutable for NonZero<i64>

§

impl Immutable for NonZero<i128>

§

impl Immutable for NonZero<isize>

§

impl Immutable for NonZero<u8>

§

impl Immutable for NonZero<u16>

§

impl Immutable for NonZero<u32>

§

impl Immutable for NonZero<u64>

§

impl Immutable for NonZero<u128>

§

impl Immutable for NonZero<usize>

§

impl Immutable for bool

§

impl Immutable for char

§

impl Immutable for f32

§

impl Immutable for f64

§

impl Immutable for i8

§

impl Immutable for i16

§

impl Immutable for i32

§

impl Immutable for i64

§

impl Immutable for i128

§

impl Immutable for isize

§

impl Immutable for str

§

impl Immutable for u8

§

impl Immutable for u16

§

impl Immutable for u32

§

impl Immutable for u64

§

impl Immutable for u128

§

impl Immutable for usize

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)

§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L, M)

§

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>

§

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<A, B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(A, B, C, D, E, F, G, H, I, J, K, L) -> M>

§

impl<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<A, B, C, D, E, F, G, H, I, J, K, L> Immutable for (A, B, C, D, E, F, G, H, I, J, K, L)

§

impl<A, B, C, D, E, F, G, H, I, J, K> Immutable for (A, B, C, D, E, F, G, H, I, J, K)

§

impl<A, B, C, D, E, F, G, H, I, J> Immutable for (A, B, C, D, E, F, G, H, I, J)

§

impl<A, B, C, D, E, F, G, H, I> Immutable for (A, B, C, D, E, F, G, H, I)

§

impl<A, B, C, D, E, F, G, H> Immutable for (A, B, C, D, E, F, G, H)

§

impl<A, B, C, D, E, F, G> Immutable for (A, B, C, D, E, F, G)

§

impl<A, B, C, D, E, F> Immutable for (A, B, C, D, E, F)

§

impl<A, B, C, D, E> Immutable for (A, B, C, D, E)
where A: Immutable, B: Immutable, C: Immutable, D: Immutable, E: Immutable,

§

impl<A, B, C, D> Immutable for (A, B, C, D)
where A: Immutable, B: Immutable, C: Immutable, D: Immutable,

§

impl<A, B, C> Immutable for (A, B, C)
where A: Immutable, B: Immutable, C: Immutable,

§

impl<A, B> Immutable for (A, B)
where A: Immutable, B: Immutable,

§

impl<A> Immutable for (A,)
where A: Immutable,

§

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>

§

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<B, C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(B, C, D, E, F, G, H, I, J, K, L) -> M>

§

impl<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<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>

§

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<C, D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(C, D, E, F, G, H, I, J, K, L) -> M>

§

impl<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<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>

§

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<D, E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(D, E, F, G, H, I, J, K, L) -> M>

§

impl<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<E, F, G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(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<E, F, G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(E, F, G, H, I, J, K, L) -> M>

§

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

§

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

§

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

§

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

§

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

§

impl<G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(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<G, H, I, J, K, L, M> Immutable for Option<unsafe extern "C" fn(G, H, I, J, K, L) -> M>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

Implementors§

Source§

impl Immutable for TestRecord

§

impl<O> Immutable for F32<O>

§

impl<O> Immutable for F64<O>

§

impl<O> Immutable for I16<O>

§

impl<O> Immutable for I32<O>

§

impl<O> Immutable for I64<O>

§

impl<O> Immutable for I128<O>

§

impl<O> Immutable for Isize<O>

§

impl<O> Immutable for U16<O>

§

impl<O> Immutable for U32<O>

§

impl<O> Immutable for U64<O>

§

impl<O> Immutable for U128<O>

§

impl<O> Immutable for Usize<O>

§

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

§

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

Source§

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