pub struct Promise<T> where
    T: 'static + Send
{ /* private fields */ }
Expand description

A Future that resolves when you call set on its clone.

Uses Arc internally. All clones of this struct use the same inner struct on the heap.

You can call set on any clone of this struct.

You can call set once and await once, obtaining the value.

Subsequent or concurrent awaits of the struct will wait forever.

Implementations

Returns true if set has been called.

Panics

Panics if the inner mutex is poisoned.

Sets the value of the struct and wakes up any awaiting task.

Consumes the struct.

Panics

Panics if the value was already set.

Sets the value of the struct and wakes up any awaiting task.

Errors

Returns Err(value) if the value was already set. This returns the value just passed in.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

The type of value produced on completion.

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. 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.

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

🔬 This is a nightly-only experimental API. (into_future)

Creates a future from a value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.