Struct glommio::task::Task [−][src]
pub struct Task { /* fields omitted */ }
Expand description
A task reference that runs its future.
At any moment in time, there is at most one Task
reference associated
with a particular task. Running consumes the Task
reference and polls
its internal future. If the future is still pending after getting polled,
the Task
reference simply won’t exist until a Waker
notifies the
task. If the future completes, its result becomes available to the
JoinHandle
.
When a task is woken up, its Task
reference is recreated and passed to
the schedule function. In most executors, scheduling simply pushes the
Task
reference into a queue of runnable tasks.
If the Task
reference is dropped without getting run, the task is
automatically canceled. When canceled, the task won’t be scheduled again
even if a Waker
wakes it. It is possible for the JoinHandle
to
cancel while the Task
reference exists, in which case an attempt
to run the task won’t do anything.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Task
impl UnwindSafe for Task
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more