https://github.com/vi/compactmap
CompactMap data structure for Rust
https://github.com/vi/compactmap
data-structure map rust slab
Last synced: about 1 year ago
JSON representation
CompactMap data structure for Rust
- Host: GitHub
- URL: https://github.com/vi/compactmap
- Owner: vi
- Created: 2015-12-01T01:47:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-10T00:13:44.000Z (over 8 years ago)
- Last Synced: 2025-04-15T14:13:33.552Z (about 1 year ago)
- Topics: data-structure, map, rust, slab
- Language: Rust
- Homepage: https://docs.rs/compactmap/
- Size: 86.9 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Compactmap - Vec-based map that uses usize as key type and maintains internal linked list for removed nodes.
You don't choose the key when inserting a new value. You can remove any entry.
Based on [this post](https://play.rust-lang.org/?gist=599f79559d6f18cc0266&version=stable) by [eddyb](https://github.com/eddyb).
The function and structure of CompactMap is almost the same as [Slab](https://docs.rs/slab) apart from missing cached length and more features. If I knew about Slab earlier, CompactMap wouldn't have appeared.
TODO:
* More thorough tests
* Entry (is it really needed?)
License is MIT or Apache, like for Rust itself.