pub struct Handle { /* private fields */ }
Expand description

Handle to timer instance.

The Handle allows creating Delay instances that are driven by the associated timer.

A Handle is obtained by calling Timer::handle, Handle::current, or Handle::default.

  • Timer::handle: returns a handle associated with the specific timer. The handle will always reference the same timer.

  • Handle::current: returns a handle to the timer for the execution context at the time the function is called. This function must be called from a runtime that has an associated timer or it will panic. The handle will always reference the same timer.

  • Handle::default: returns a handle to the timer for the execution context at the time the handle is used. This function is safe to call at any time. The handle may reference different specific timer instances. Calling Handle::default().delay(...) is always equivalent to Delay::new(...).

Implementations

Returns a handle to the current timer.

The current timer is the timer that is currently set as default using with_default.

This function should only be called from within the context of with_default. Calling this function from outside of this context will return a Handle that does not reference a timer. Delay instances created with this handle will error.

See type level documentation for more ways to obtain a Handle value.

Create a Delay driven by this handle’s associated Timer.

Create a Timeout driven by this handle’s associated Timer.

Create a new Interval that starts at at and yields every duration interval after that.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.