#timeout #fibers #queue #push

fibers_timeout_queue

Timeout queue based on fibers crate

1 unstable release

Uses old Rust 2015

0.1.0 Sep 13, 2018

#14 in #fibers

Download history 6/week @ 2024-07-29 15/week @ 2024-08-05 8/week @ 2024-08-12 2/week @ 2024-08-19 19/week @ 2024-08-26 2/week @ 2024-09-02 14/week @ 2024-09-09 7/week @ 2024-09-16 22/week @ 2024-09-23 10/week @ 2024-09-30 12/week @ 2024-10-14 20/week @ 2024-10-28 22/week @ 2024-11-04

54 downloads per month
Used in 2 crates

MIT license

11KB
133 lines

fibers_timeout_queue

Crates.io: fibers_timeout_queue Documentation Build Status Code Coverage License: MIT

This crate provides a timeout queue based on fibers crate.

Documentation

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);

Dependencies

~1–1.2MB
~20K SLoC