pub struct TimerRegistry { /* private fields */ }

Implementations§

Schedules a timer to expire in “Duration”, once expired, returns a TimeHandlerGuard that must be dropped only once the timer event has been fully processed (all sideeffects finished).

Roughly eqivalent to async pub fn sleep(&self, duration: Duration) -> TimeHandlerGuard.

Schedules a timer to expire at “Instant”, once expired, returns a TimeHandlerGuard that must be dropped only once the timer event has been fully processed (all sideeffects finished).

Roughly eqivalent to async pub fn sleep_until(&self, until: Instant) -> TimeHandlerGuard.

Panics

When until was created by a different instance of TimerRegistry.

Combines a future with a sleep timer. If the future finishes before the timer has expired, returns the futures output. Otherwise returns Elapsed which contains a TimeHandlerGuard that must be dropped once the timeout has been fully processed (all sideeffects finished).

Roughly equivalent to async pub fn timeout<F: Future>(&self, timeout: Duration, future: F) -> Result<F::Output, Elapsed>

Combines a future with a sleep_until timer. If the future finishes before the timer has expired, returns the futures output. Otherwise returns Elapsed which contains a TimeHandlerGuard that must be dropped once the timeout has been fully processed (all sideeffects finished).

Roughly equivalent to async pub fn timeout_at<F: Future>(&self, at: Instant, future: F) -> Result<F::Output, Elapsed>

Panics

When at was created by a different instance of TimerRegistry.

Advances test time by the given duration. Starts all scheduled timers that have expired at the new (advanced) point in time in the following order:

  1. By time they are scheduled to run at
  2. By the order they were scheduled

If no timer has been scheduled yet, waits until one is. Returns only once all started timers have finished processing.

Current test time, increases on every call to [advance_time].

Trait Implementations§

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