[][src]Module tokio_timer::timer

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

Re-exports

pub use self::now::SystemNow;

Structs

Handle

Handle to timer instance.

Timer

Timer implementation that drives Delay, Interval, and Timeout.

Turn

Return value from the turn method on Timer.

Functions

set_default

Sets handle to default timer, returning guard that unsets it on drop.