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ยง
Sourceยงimpl<'a> Context<'a>
impl<'a> Context<'a>
1.36.0 (const: 1.82.0) ยท Sourcepub const fn from_waker(waker: &'a Waker) -> Self
pub const fn from_waker(waker: &'a Waker) -> Self
Creates a new Context
from a &Waker
.
1.36.0 (const: 1.82.0) ยท Sourcepub const fn waker(&self) -> &'a Waker
pub const fn waker(&self) -> &'a Waker
Returns a reference to the Waker
for the current task.
Sourcepub const fn local_waker(&self) -> &'a LocalWaker
๐ฌThis is a nightly-only experimental API. (local_waker
#118959)
pub const fn local_waker(&self) -> &'a LocalWaker
local_waker
#118959)Returns a reference to the LocalWaker
for the current task.
Trait Implementationsยง
Auto Trait Implementationsยง
impl<'a> Freeze for Context<'a>
impl<'a> RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnwindSafe for Context<'a>
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more