pub struct Wait<'wait_list, L: Lock, I, O, OnCancel> where
    OnCancel: CancelCallback<'wait_list, L, I, O>, 
{ /* private fields */ }
Expand description

The future of a waiting operation.

This type provides a lower-level API than LockedExclusive::init_and_wait, but is useful if your guard types are !Send but you still want the outer future to remain Send.

Awaiting and polling this future will panic if you have not called init yet.

Implementations

Create a new Wait future.

The returned future will be in its “completed” state, so attempting to .await it will panic unless init is called.

Check whether this future is in its completed state or not.

Initialize the future, moving it from a completed to waiting state.

This function is mostly only useful inside a poll function (when you have a cx variable to hand). After calling this, you should return Poll::Pending as the given waker has been successfully registered in the wait list.

A callback must be supplied to call in the event that the future has been woken but was cancelled before it could complete. You will often want to re-call LockedExclusive::wake_one in this case to pass on the notification to someone else.

Panics

Panics if called on a non-completed future.

The same as init but not requiring a task::Waker, instead substituting in a temporary no-op waker.

Using this API is always less efficient than writing a poll function manually that calls init, but it can be useful if you (a) need Send futures but have !Send mutex guards and (b) want to stay in an async context.

Trait Implementations

Formats the value using the given formatter. Read more

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

Executes the destructor for this 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 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.