Module tokio_timer::timer [] [src]

Timer implementation.

This module contains the types needed to run a timer.

The Timer type runs the timer logic. It holds all the necessary state to track all associated Delay instances and delivering notifications once the deadlines are reached.

The Handle type is a reference to a Timer instance. This type is Clone, Send, and Sync. This type is used to create instances of Delay.

The Now trait describes how to get an Instance representing the current moment in time. [SystemNow] is the default implementation, where Now::now is implemented by calling Instant::now.

Timer is generic over Now. This allows the source of time to be customized. This ability is especially useful in tests and any environment where determinism is necessary.

Note, when using the Tokio runtime, the Timer does not need to be manually setup as the runtime comes pre-configured with a Timer instance.

Structs

Handle

Handle to timer instance.

SystemNow

A handle to a source of time.

Timer

Timer implementation that drives Delay, Interval, and Deadline.

Turn

Return value from the turn method on Timer.

Functions

with_default

Set the default timer for the duration of the closure.