Crate fibers_timeout_queue[−][src]
This crate provides a timeout queue based on fibers
crate.
Examples
use fibers_timeout_queue::TimeoutQueue; use std::time::Duration; use std::thread; let mut queue = TimeoutQueue::new(); assert_eq!(queue.pop(), None); // `queue` is empty queue.push(1, Duration::from_millis(1000)); queue.push(2, Duration::from_millis(100)); queue.push(3, Duration::from_millis(10)); assert_eq!(queue.pop(), None); // No expired items thread::sleep(Duration::from_millis(50)); assert_eq!(queue.pop(), Some(3)); // There is an expired item assert_eq!(queue.pop(), None);
Structs
TimeoutQueue |
Timeout queue. |