Skip to content

Commit

Permalink
Add DelayQueue implementation to tokio-timer (#550)
Browse files Browse the repository at this point in the history
This patch adds a `DelayQueue` to tokio_timer. The `DelayQueue` allows
inserting elements as well as specifying a time at which the element
should be returned to the user. This allows handling more complex
timeout situations.
  • Loading branch information
carllerche authored Aug 21, 2018
1 parent c66b56c commit d822b72
Show file tree
Hide file tree
Showing 14 changed files with 1,803 additions and 518 deletions.
6 changes: 6 additions & 0 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
//! a specified `Instant` in time. If the future 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 types are sufficient for handling a large number of scenarios
//! involving time.
//!
Expand Down Expand Up @@ -79,10 +82,13 @@
//! [Deadline]: struct.Deadline.html
//! [Delay]: struct.Delay.html
//! [Interval]: struct.Interval.html
//! [`DelayQueue`]: struct.DelayQueue.html
pub use tokio_timer::{
delay_queue,
Deadline,
DeadlineError,
DelayQueue,
Error,
Interval,
Delay,
Expand Down
5 changes: 5 additions & 0 deletions tokio-timer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ Timer facilities for Tokio
futures = "0.1.19"
tokio-executor = { version = "0.1.1", path = "../tokio-executor" }

# Backs `DelayQueue`
slab = "0.4.1"

[dev-dependencies]
rand = "0.5"
tokio-mock-task = "0.1.0"
tokio = { version = "0.1.7", path = "../" }
Loading

0 comments on commit d822b72

Please sign in to comment.