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
sourceimpl RawWaker
impl RawWaker
const: 1.36.0 · sourcepub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker
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.
sourcepub fn data(&self) -> *const ()
🔬This is a nightly-only experimental API. (waker_getters
)
pub fn data(&self) -> *const ()
waker_getters
)Get the data
pointer used to create this RawWaker
.
sourcepub fn vtable(&self) -> &'static RawWakerVTable
🔬This is a nightly-only experimental API. (waker_getters
)
pub fn vtable(&self) -> &'static RawWakerVTable
waker_getters
)Get the vtable
pointer used to create this RawWaker
.