Struct Context
pub struct Context<'a> { /* private fields */ }
Expand description
The context of an asynchronous task.
Currently, Context
only serves to provide access to a &Waker
which can be used to wake the current task.
Implementations§
§impl<'a> Context<'a>
impl<'a> Context<'a>
1.36.0 (const: 1.82.0)pub const fn from_waker(waker: &'a Waker) -> Context<'a>
pub const fn from_waker(waker: &'a Waker) -> Context<'a>
Creates a new Context
from a &Waker
.
1.36.0 (const: 1.82.0)pub const fn waker(&self) -> &'a Waker
pub const fn waker(&self) -> &'a Waker
Returns a reference to the Waker
for the current task.
pub const fn local_waker(&self) -> &'a LocalWaker
🔬This is a nightly-only experimental API. (local_waker
)
pub const fn local_waker(&self) -> &'a LocalWaker
local_waker
)Returns a reference to the [LocalWaker
] for the current task.
pub const fn ext(&mut self) -> &mut (dyn Any + 'static)
🔬This is a nightly-only experimental API. (context_ext
)
pub const fn ext(&mut self) -> &mut (dyn Any + 'static)
context_ext
)Returns a reference to the extension data for the current task.