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 moreAuto Trait Implementations§
impl Freeze for TaskHandle
impl !RefUnwindSafe for TaskHandle
impl Send for TaskHandle
impl Sync for TaskHandle
impl Unpin for TaskHandle
impl UnsafeUnpin for TaskHandle
impl !UnwindSafe for TaskHandle
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more