pub struct TaskHandle { /* private fields */ }
Expand description
A handle used to control a TaskSchedule
.
When the final handle is dropped, the computation governed by the
TaskSchedule
should terminate.
Implementations§
Source§impl TaskHandle
impl TaskHandle
Sourcepub fn fire(&self) -> bool
pub fn fire(&self) -> bool
Trigger this handle’s corresponding schedule now.
Returns true
if the schedule still exists, and false
otherwise.
Sourcepub fn fire_at(&self, instant: Instant) -> bool
pub fn fire_at(&self, instant: Instant) -> bool
Trigger this handle’s corresponding schedule at instant
.
Returns true
if the schedule still exists, and false
otherwise.
Sourcepub fn cancel(&self) -> bool
pub fn cancel(&self) -> bool
Cancel a pending firing of the handle’s corresponding schedule.
Returns true
if the schedule still exists, and false
otherwise.
Sourcepub fn suspend(&self) -> bool
pub fn suspend(&self) -> bool
Suspend execution of the corresponding schedule.
If the schedule is ready now, it will become pending; it won’t become
ready again until resume()
is called. If the schedule is waiting for a
timer, the timer will keep counting, but the schedule won’t become ready
until the timer has elapsed and resume()
has been called.
Returns true
if the schedule still exists, and false
otherwise.
Sourcepub fn resume(&self) -> bool
pub fn resume(&self) -> bool
Resume execution of the corresponding schedule.
This method undoes the effect of a call to suspend()
: the schedule
will fire again if it is ready (or when it becomes ready).
This method won’t cause the schedule to fire if it was already
cancelled. For that, use the fire()
or fire_at()` methods.
Returns true
if the schedule still exists, and false
otherwise.
Trait Implementations§
Source§impl Clone for TaskHandle
impl Clone for TaskHandle
Source§fn clone(&self) -> TaskHandle
fn clone(&self) -> TaskHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more