[−][src]Module kayrx::timer
Utilities for tracking time.
This crate provides a number of utilities for working with periods of time:
-
Delay
: A future that completes at a specified instant in time. -
Interval
A stream that yields at fixed time intervals. -
Throttle
: Throttle down a stream by enforcing a fixed delay between items. -
Timeout
: Wraps a future or stream, setting an upper bound to the amount of time it is allowed to execute. If the future or stream does not complete in time, then it is canceled and an error is returned. -
DelayQueue
: A queue where items are returned once the requested delay has expired.
These three types are backed by a Timer
instance. In order for
Delay
, Interval
, and Timeout
to function, the associated
Timer
instance must be running on some thread.
Modules
delay_queue | A queue of delayed elements. |
Structs
Clock | A handle to a source of time. |
Delay | A future that completes at a specified instant in time. |
DelayQueue | A queue of delayed elements. |
Elapsed | Error returned by |
Error | Errors encountered by the timer implementation. |
Handle | Handle to timer instance. |
Interval | A stream representing notifications at fixed interval |
SystemNow | A handle to a source of time. |
Throttle | Slow down a stream by enforcing a delay between items. |
Timeout | Allows a |
Timer | Timer implementation that drives |
Turn | Return value from the |
Traits
Now | Returns |
Functions
delay | Create a Future that completes at |
delay_for | Create a Future that completes in |
now | Returns an |
set_default | Sets handle to default timer, returning guard that unsets it on drop. |
with_default | Set the default clock for the duration of the closure. |