pub struct UncheckedCell<T> {
value: UnsafeCell<MaybeUninit<T>>,
}Expand description
A datatype with interior mutability, which can be uninitialized via [MaybeUninit]
When the cargo feature debug-checks is enabled, this type also checks for double initialization
and uninitialized access.
Fields§
§value: UnsafeCell<MaybeUninit<T>>Implementations§
Source§impl<T> UncheckedCell<T>
impl<T> UncheckedCell<T>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Constructor; creates a new UncheckedCell
Sourcepub unsafe fn init(&self, value: T)
pub unsafe fn init(&self, value: T)
Initialize the inner value
§Safety
The caller must guarantee the following:
- That this method has never been called before and will never be called again
- That at the time of calling this method, no references or pointers to this data exist
- While this method is being called, no other CPU is working with the given data