[][src]Struct maybe_cell::checked::Maybe

pub struct Maybe<T> { /* fields omitted */ }

Equivalent to an UnsafeCell<MaybeUninit<T>>, this cell may hold uninitialized data.


impl<T> Maybe<T>[src]

pub const fn empty() -> Self[src]

Create a new, empty Maybe<T>.

pub const fn new(data: T) -> Self[src]

Create a new, populated Maybe<T>.

pub unsafe fn as_ptr(&self) -> *const T[src]

Access the contained value as a constant pointer.

pub unsafe fn as_mut_ptr(&mut self) -> *mut T[src]

Access the contained value as a mutable pointer.

pub unsafe fn as_ref(&self) -> &T[src]

Obtain a reference to the contained value. This method is unsafe because the value may not have been initialized.

pub unsafe fn as_mut(&mut self) -> &mut T[src]

Obtain a mutable reference to the contained value.

pub fn set_loaded(&self, loaded: bool)[src]

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.

pub unsafe fn clear(&self)[src]

Drop the contained value in place.

pub unsafe fn load(&self) -> T[src]

Load the contained value.

pub unsafe fn replace(&self, value: T) -> T[src]

Store a new value in an occupied cell.

pub unsafe fn store(&self, value: T)[src]

Store a new value in an empty cell.

Trait Implementations

impl<T: Debug> Debug for Maybe<T>[src]

impl<T> Drop for Maybe<T>[src]

impl<T> From<T> for Maybe<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Maybe<T>[src]

impl<T> Send for Maybe<T> where
    T: Send

impl<T> !Sync for Maybe<T>[src]

impl<T> Unpin for Maybe<T> where
    T: Unpin

impl<T> UnwindSafe for Maybe<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.