[−][src]Struct core::task::Context
pub struct Context<'a> { /* fields omitted */ }🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Information about the currently-running task.
Contexts are always tied to the stack, since they are set up specifically
when performing a single poll step on a task.
Methods
impl<'a> Context<'a>[src]
impl<'a> Context<'a>pub fn new(local_waker: &'a LocalWaker, spawner: &'a mut Spawn) -> Context<'a>[src]
pub fn new(local_waker: &'a LocalWaker, spawner: &'a mut Spawn) -> Context<'a>🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Create a new task Context with the provided local_waker, waker,
and spawner.
pub fn local_waker(&self) -> &'a LocalWaker[src]
pub fn local_waker(&self) -> &'a LocalWaker🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Get the LocalWaker associated with the current task.
pub fn waker(&self) -> &'a Waker[src]
pub fn waker(&self) -> &'a Waker🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Get the Waker associated with the current task.
pub fn spawner(&mut self) -> &mut Spawn[src]
pub fn spawner(&mut self) -> &mut Spawn🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Get the spawner associated with this task.
This method is useful primarily if you want to explicitly handle spawn failures.
pub fn with_waker<'b>(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b>[src]
pub fn with_waker<'b>(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b>🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Produce a context like the current one, but using the given waker instead.
This advanced method is primarily used when building "internal schedulers" within a task, where you want to provide some customized wakeup logic.
pub fn with_spawner<'b, Sp: Spawn>(
&'b mut self,
spawner: &'b mut Sp
) -> Context<'b>[src]
pub fn with_spawner<'b, Sp: Spawn>(
&'b mut self,
spawner: &'b mut Sp
) -> Context<'b>🔬 This is a nightly-only experimental API. (futures_api #50547)
futures in libcore are unstable
Produce a context like the current one, but using the given spawner instead.
This advanced method is primarily used when building "internal schedulers" within a task.