18 releases

Uses old Rust 2015

0.2.1 Sep 13, 2017
0.2.0 Jul 21, 2017
0.1.16 Jul 10, 2017
0.1.11 Jun 27, 2017

⚠️ Issues reported

#1980 in Data structures

MIT license

24KB
707 lines

id-map


lib.rs:

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");

Dependencies

~49KB