pub unsafe trait Uninit: Copy {
// Provided method
fn alloc() -> Box<Self> { ... }
}
Expand description
Marker trait for types that are normally assumed uninitialized
§Safety
By implementing this trait, it’s a guarantee that uninitialized memory
may be transmuted into this type safely. It implies that the type is Copy
.
It should contain no bits except for MaybeUninit
fields. Structs and
arrays made entirely of MaybeUninit
are fine.
This memory is always assumed to be uninitialized unless we hold a mutable reference that’s associated with information about specific fields that were initialized during the reference’s lifetime.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl Uninit for SolverMemoryInner
SAFETY: We are proimising that SolverMemoryInner
is
made only from Uninit
types like BucketArrayMemory
.
impl<const N: usize, const M: usize, T: Copy> Uninit for BucketArrayMemory<N, M, T>
Implements the Uninit
trait. This memory is always assumed to be
uninitialized unless we hold a mutable reference paired with bucket
usage information.
SAFETY: We can implement Uninit
for BucketArrayMemory
because it’s Copy
and it contains only MaybeUninit
bits.