Struct core::task::RawWaker

1.36.0 · source ·
pub struct RawWaker { /* private fields */ }
Expand description

A RawWaker allows the implementor of a task executor to create a Waker which provides customized wakeup behavior.

It consists of a data pointer and a virtual function pointer table (vtable) that customizes the behavior of the RawWaker.

Implementations§

Creates a new RawWaker from the provided data pointer and vtable.

The data pointer can be used to store arbitrary data as required by the executor. This could be e.g. a type-erased pointer to an Arc that is associated with the task. The value of this pointer will get passed to all functions that are part of the vtable as the first parameter.

The vtable customizes the behavior of a Waker which gets created from a RawWaker. For each operation on the Waker, the associated function in the vtable of the underlying RawWaker will be called.

🔬This is a nightly-only experimental API. (waker_getters #87021)

Get the data pointer used to create this RawWaker.

🔬This is a nightly-only experimental API. (waker_getters #87021)

Get the vtable pointer used to create this RawWaker.

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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.