pub struct AtomicLazyCell<T> { /* private fields */ }
Expand description

A lazily filled and thread-safe Cell, with frozen contents.

Implementations

An empty AtomicLazyCell.

Creates a new, empty, AtomicLazyCell.

Put a value into this cell.

This function will return Err(value) if the cell is already full.

Put a value into this cell.

Note that this function is infallible but requires &mut self. By requiring &mut self we’re guaranteed that no active borrows to this cell can exist so we can always fill in the value. This may not always be usable, however, as &mut self may not be possible to borrow.

Return value

This function returns the previous value, if any.

Test whether this cell has been previously filled.

Borrows the contents of this lazy cell for the duration of the cell itself.

This function will return Some if the cell has been previously initialized, and None if it has not yet been initialized.

Consumes this LazyCell, returning the underlying value.

Returns a copy of the contents of the lazy cell.

This function will return Some if the cell has been previously initialized, and None if it has not yet been initialized.

Trait Implementations

Create a clone of this AtomicLazyCell

If self has not been initialized, returns an uninitialized AtomicLazyCell otherwise returns an AtomicLazyCell already initialized with a clone of the contents of self.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.