Carl Lerche 19500f7df8
Provide a timer implementation (#249)
This patch adds a new crate: tokio-timer. This crate provides an
efficient timer implemeentation designed for use in Tokio based
applications.

The timer users a hierarchical hashed timer wheel algorithm with six
levels, each having 64 slots. This allows the timer to have a resolution
of 1ms while maintaining O(1) complexity for insert, removal, and firing
of timeouts.

There already exists a tokio-timer crate. This is a complete rewrite
which solves the outstanding problems with the existing tokio-timer
library.

Closes #146.
2018-03-28 22:26:47 -07:00

42 lines
1.2 KiB
Rust

//! Utilities for scheduling work to happen after a period of time.
//!
//! This crate provides a number of utilities for working with periods of time:
//!
//! * [`Sleep`]: A future that completes at a specified instant in time.
//!
//! * [`Interval`] A stream that yields at fixed time intervals.
//!
//! * [`Deadline`]: Wraps a future, requiring it to complete before a specified
//! instant in time, erroring if the future takes too long.
//!
//! These three types are backed by a [`Timer`] instance. In order for
//! [`Sleep`], [`Interval`], and [`Deadline`] to function, the associated
//! [`Timer`] instance must be running on some thread.
//!
//! [`Sleep`]: struct.Sleep.html
//! [`Deadline`]: struct.Deadline.html
//! [`Interval`]: struct.Interval.html
//! [`Timer`]: timer/struct.Timer.html
#![doc(html_root_url = "https://docs.rs/tokio-timer/0.2.0")]
#![deny(missing_docs, warnings, missing_debug_implementations)]
extern crate tokio_executor;
#[macro_use]
extern crate futures;
pub mod timer;
mod atomic;
mod deadline;
mod error;
mod interval;
mod sleep;
pub use self::deadline::{Deadline, DeadlineError};
pub use self::error::Error;
pub use self::interval::Interval;
pub use self::timer::{Timer, with_default};
pub use self::sleep::Sleep;