pub struct Handle<E> { /* private fields */ }Expand description
A handle for a scheduled future event, allowing the holder to reschedule or cancel the event.
The handle may outlive the event it relates to. Calling methods on such a lapsed Handle is safe.
Handles that aren’t needed for cancellation or rescheduling can be dropped without impacting the related event.
Implementations§
Source§impl<E> Handle<E>
impl<E> Handle<E>
Sourcepub fn cancel(self)
pub fn cancel(self)
Attempts to cancel the event.
If the event hasn’t yet occurred when cancel is called, it is canceled and will not be
returned by Scheduler::dispatch. Cancelling an event that has already been dispatched
is a no-op.
Sourcepub fn reschedule(self, when: TimeRange) -> Option<Handle<E>>
pub fn reschedule(self, when: TimeRange) -> Option<Handle<E>>
Attempts to reschedule the event to a new time range.
Returns an updated Handle if rescheduling succeeds, or None if the event has already been dispatched.
Auto Trait Implementations§
impl<E> Freeze for Handle<E>
impl<E> RefUnwindSafe for Handle<E>where
E: RefUnwindSafe,
impl<E> Send for Handle<E>
impl<E> Sync for Handle<E>
impl<E> Unpin for Handle<E>
impl<E> UnsafeUnpin for Handle<E>
impl<E> UnwindSafe for Handle<E>where
E: RefUnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more