Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ralith/timer-queue
Pure, minimal, and scalable timers
https://github.com/ralith/timer-queue
Last synced: about 2 months ago
JSON representation
Pure, minimal, and scalable timers
- Host: GitHub
- URL: https://github.com/ralith/timer-queue
- Owner: Ralith
- License: apache-2.0
- Created: 2022-09-28T04:05:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T17:31:20.000Z (about 2 years ago)
- Last Synced: 2024-10-18T21:55:42.685Z (2 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 24
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# timer-queue
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE-APACHE)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE-MIT)
[![License: Zlib](https://img.shields.io/badge/License-Zlib-blue.svg)](LICENSE-ZLIB)A pure, minimal, and scalable structure for tracking expiration of timers
```rust
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"));
```## License
Licensed under any of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
* Zlib license ([LICENSE-ZLIB](LICENSE-ZLIB) or
https://opensource.org/licenses/Zlib)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
triple licensed as above, without any additional terms or conditions.