Crate timer_queue

Source
Expand description

A pure, minimal, and scalable structure for tracking expiration of timers

let mut q = TimerQueue::new();
q.insert(42, "second");
q.insert(17, "first");
assert!(q.next_timeout().unwrap() <= 17);
assert_eq!(q.poll(16), None);
assert_eq!(q.poll(17), Some("first"));
assert_eq!(q.poll(100), Some("second"));

Structsยง

Timer
Handle to a specific timer, obtained from TimerQueue::insert
TimerQueue
Stores values to be yielded at specific times in the future