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

#1810 in Data structures

Download history 74/week @ 2024-02-25 73/week @ 2024-03-03 2/week @ 2024-03-10

149 downloads per month

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