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§
impl Immutable for bool
impl Immutable for char
impl Immutable for f16
Available on crate feature
float-nightly
only.impl Immutable for f32
impl Immutable for f64
impl Immutable for f128
Available on crate feature
float-nightly
only.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 ()
impl Immutable for usize
impl Immutable for __m128
Available on x86 and crate feature
simd
only.impl Immutable for __m128d
Available on x86 and crate feature
simd
only.impl Immutable for __m128i
Available on x86 and crate feature
simd
only.impl Immutable for __m256
Available on x86 and crate feature
simd
only.impl Immutable for __m256d
Available on x86 and crate feature
simd
only.impl Immutable for __m256i
Available on x86 and crate feature
simd
only.impl Immutable for __m512
Available on crate feature
simd-nightly
and x86 and crate feature simd
only.impl Immutable for __m512bh
Available on crate feature
simd-nightly
and x86 and crate feature simd
only.impl Immutable for __m512d
Available on crate feature
simd-nightly
and x86 and crate feature simd
only.impl Immutable for __m512i
Available on crate feature
simd-nightly
and x86 and crate feature simd
only.impl Immutable for NonZeroI8
impl Immutable for NonZeroI16
impl Immutable for NonZeroI32
impl Immutable for NonZeroI64
impl Immutable for NonZeroI128
impl Immutable for NonZeroIsize
impl Immutable for NonZeroU8
impl Immutable for NonZeroU16
impl Immutable for NonZeroU32
impl Immutable for NonZeroU64
impl Immutable for NonZeroU128
impl Immutable for NonZeroUsize
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<extern "C" fn(_: A, _: 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<extern "C" 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<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<extern "C" 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<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<extern "C" fn(_: 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<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<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<extern "C" fn(_: 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<G, H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: 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<H, I, J, K, L, M> Immutable for Option<extern "C" fn(_: H, _: 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<extern "C" fn(_: I, _: 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<extern "C" fn(_: J, _: K, _: L) -> M>
impl<K, L, M> Immutable for Option<fn(_: K, _: L) -> M>
impl<K, L, M> Immutable for Option<extern "C" fn(_: K, _: L) -> M>
impl<L, M> Immutable for Option<fn(_: L) -> M>
impl<L, M> Immutable for Option<extern "C" fn(_: L) -> M>
impl<M> Immutable for Option<fn() -> M>
impl<M> Immutable for Option<extern "C" fn() -> M>
impl<T: Sized> Immutable for Box<T>
Available on crate feature
alloc
only.