19 releases
Uses old Rust 2015
| 0.2.2 | Aug 14, 2025 |
|---|---|
| 0.2.1 | Sep 13, 2017 |
| 0.2.0 | Jul 21, 2017 |
| 0.1.16 | Jul 10, 2017 |
| 0.1.11 | Jun 27, 2017 |
#482 in Data structures
796 downloads per month
25KB
678 lines
IdMap is a container that gives each item a unique id. Adding and removing by index is O(1).
Examples
#
let mut map = IdMap::new();
let blue_id = map.insert("blue");
let red_id = map.insert("red");
map.retain(|_, &color| color != "red");
assert!(!map.contains(red_id));
assert_eq!(map[blue_id], "blue");
id-map
See also slab or slotmap for a better optimized version of this crate.
Dependencies
~49KB