Struct async_once_cell::OnceFuture[][src]

pub struct OnceFuture<T, F = Box<dyn Future<Output = T> + Send>, I = Infallible> { /* fields omitted */ }
Expand description

A Future which is executed exactly once, producing an output accessible without locking.

This is primarily used as a building block for Lazy and ConstLazy, but can be used on its own to produce more complex building blocks.

Implementations

Creates a new OnceFuture with an initializing value

Gets the value without blocking or starting the initialization.

Get mutable access to the initializer or final value.

This requires mutable access to self, so rust’s aliasing rules prevent any concurrent access and allow violating the usual rules for accessing this cell.

Gets the initializer or final value

Creates a new OnceFuture without an initializing value

The resulting Future must be produced by the closure passed to get_or_init_with

Creates a new OnceFuture directly from a Future.

The gen_future or init_future functions will never be called.

Create and run the future until it produces a result, then return a reference to that result.

Create and run the future until it produces a result, then return a reference to that result.

Create and run the future until it produces a result, then return a reference to that result.

Create and run the future until it produces a result, then return a reference to that result.

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

Performs the conversion.

Performs the conversion.

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.