Struct futures::task::Task
[−]
[src]
pub struct Task { /* fields omitted */ }
A handle to a "task", which represents a single lightweight "thread" of execution driving a future to completion.
In general, futures are composed into large units of work, which are then spawned as tasks onto an executor. The executor is responsible for polling the future as notifications arrive, until the future terminates.
This is obtained by the task::park
function.
Methods
impl Task
[src]
fn unpark(&self)
Indicate that the task should attempt to poll its future in a timely fashion.
It's typically guaranteed that, for each call to unpark
, poll
will
be called at least once subsequently (unless the task has terminated).
If the task is currently polling its future when unpark
is called, it
must poll the future again afterwards, ensuring that all relevant
events are eventually observed by the future.
fn is_current(&self) -> bool
Returns true
when called from within the context of the task. In
other words, the task is currently running on the thread calling the
function.
Trait Implementations
impl Clone for Task
[src]
fn clone(&self) -> Task
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more