pub struct Maybe<T> { /* private fields */ }
Expand description
Equivalent to an UnsafeCell<MaybeUninit<T>>
, this cell may hold uninitialized data.
Implementations§
Source§impl<T> Maybe<T>
impl<T> Maybe<T>
Sourcepub unsafe fn as_mut_ptr(&mut self) -> *mut T
pub unsafe fn as_mut_ptr(&mut self) -> *mut T
Access the contained value as a mutable pointer.
Sourcepub unsafe fn as_ref(&self) -> &T
pub unsafe fn as_ref(&self) -> &T
Obtain a reference to the contained value. This method is unsafe
because
the value may not have been initialized.
Sourcepub fn set_loaded(&self, loaded: bool)
pub fn set_loaded(&self, loaded: bool)
Override the loaded
flag of the cell. This method is a no-op when using the
unchecked implementation. It may be used when a value is inserted manually,
for example by assigning to the dereferenced pointer.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Maybe<T>
impl<T> !RefUnwindSafe for Maybe<T>
impl<T> Send for Maybe<T>where
T: Send,
impl<T> !Sync for Maybe<T>
impl<T> Unpin for Maybe<T>where
T: Unpin,
impl<T> UnwindSafe for Maybe<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more