Skip to main content

Handle

Struct Handle 

Source
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>

Source

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.

Source

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>
where E: Sync + Send,

§

impl<E> Sync for Handle<E>
where E: Sync + Send,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.