https://github.com/rufflewind/index_queue
A queue for unique indices with constant-time lookup and removal backed by Vec
https://github.com/rufflewind/index_queue
data-structure queue rust
Last synced: about 1 year ago
JSON representation
A queue for unique indices with constant-time lookup and removal backed by Vec
- Host: GitHub
- URL: https://github.com/rufflewind/index_queue
- Owner: Rufflewind
- License: apache-2.0
- Created: 2017-03-28T19:11:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-06T08:14:47.000Z (about 5 years ago)
- Last Synced: 2025-03-01T12:24:43.099Z (over 1 year ago)
- Topics: data-structure, queue, rust
- Language: Rust
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `index_queue`
[](https://docs.rs/index_queue)
[](https://crates.io/crates/index_queue)
[](https://github.com/Rufflewind/index_queue/actions/workflows/build.yml)
A queue for unique indices (integers) with O(1) push/pop and O(1) lookup/removal. It is a doubly-linked list with all its nodes stored inside a single Vec. The queue is most memory efficient when the integers are relatively small and densely packed. The implementation is similar to [`ixlist`](https://github.com/bluss/ixlist), but `index_queue` is more specialized: it allows querying whether an index already exists as well as removal by index, but does not allow duplicate indices.
The queue works well with indices obtained from array-based allocators such as [`vec_arena`](https://crates.io/crates/vec-arena) or [`slab`](https://crates.io/crates/slab).
This crate was originally created to implement a cooperative FIFO task scheduler ([`synchrotron`](https://github.com/Rufflewind/synchrotron)).