Struct futures::task::Context [−][src]
pub struct Context<'a> { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (futures_api
)
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,
executor: &'a mut (Executor + 'a)
) -> Context<'a>
[src]
pub fn new(
local_waker: &'a LocalWaker,
executor: &'a mut (Executor + 'a)
) -> Context<'a>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Create a new task Context
with the provided local_waker
, waker
, and executor
.
pub fn local_waker(&self) -> &'a LocalWaker
[src]
pub fn local_waker(&self) -> &'a LocalWaker
🔬 This is a nightly-only experimental API. (futures_api
)
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
)
futures in libcore are unstable
Get the Waker
associated with the current task.
pub fn executor(&mut self) -> &mut Executor
[src]
pub fn executor(&mut self) -> &mut Executor
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Get the default executor associated with this task.
This method is useful primarily if you want to explicitly handle spawn failures.
pub fn with_waker(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b>
[src]
pub fn with_waker(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b>
🔬 This is a nightly-only experimental API. (futures_api
)
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_executor<E>(&'b mut self, executor: &'b mut E) -> Context<'b> where
E: Executor,
[src]
pub fn with_executor<E>(&'b mut self, executor: &'b mut E) -> Context<'b> where
E: Executor,
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Produce a context like the current one, but using the given executor instead.
This advanced method is primarily used when building "internal schedulers" within a task.
Trait Implementations
impl<'a> Debug for Context<'a>
[src]
impl<'a> Debug for Context<'a>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a> ContextExt for Context<'a>
[src]
impl<'a> ContextExt for Context<'a>
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Ifn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Ifn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more