https://github.com/ralith/timer-queue
Pure, minimal, and scalable timers
https://github.com/ralith/timer-queue
Last synced: 3 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 (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-14T05:30:09.000Z (6 months ago)
- Last Synced: 2025-04-02T09:08:25.600Z (3 months ago)
- Language: Rust
- Size: 16.6 KB
- Stars: 26
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# timer-queue
[](LICENSE-APACHE)
[](LICENSE-MIT)
[](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.