On this page
Struct std::task::RawWaker
pub struct RawWaker { /* private fields */ }
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
impl 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.
pub fn data(&self) -> *const ()
waker_getters #87021)
Get the data pointer used to create this RawWaker.
pub fn vtable(&self) -> &'static RawWakerVTable
waker_getters #87021)
Get the vtable pointer used to create this RawWaker.
Trait Implementations
impl Debug for RawWaker
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
impl<W> From<Arc<W>> for RawWaker
where
W: Wake + Send + Sync + 'static,
fn from(waker: Arc<W>) -> RawWaker
Use a Wake-able type as a RawWaker.
No heap allocations or atomic operations are used for this conversion.
impl PartialEq for RawWaker
fn eq(&self, other: &RawWaker) -> bool
self and other values to be equal, and is used by ==.
fn ne(&self, other: &Rhs) -> bool
!=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
impl StructuralPartialEq for RawWaker
Auto Trait Implementations
impl RefUnwindSafe for RawWaker
impl !Send for RawWaker
impl !Sync for RawWaker
impl Unpin for RawWaker
impl UnwindSafe for RawWaker
Blanket Implementations
impl<T> Any for T
where
T: 'static + ?Sized,
impl<T> Borrow<T> for T
where
T: ?Sized,
impl<T> BorrowMut<T> for T
where
T: ?Sized,
impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for T
where
U: From<T>,
fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T, U> TryFrom<U> for T
where
U: Into<T>,
type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/task/struct.RawWaker.html