Crate id_map

Source
Expand description

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

Structs§

  • A container that gives each item a unique id. Internally all elements are stored contiguously.
  • An iterator over all ids, in increasing order.
  • A consuming iterator over id-value pairs, in order of increasing id.
  • An iterator over id-value pairs, in order of increasing id.
  • A mutable iterator over id-value pairs, in order of increasing id.
  • An iterator over all values, in order of increasing id.
  • A mutable iterator over all values, in order of increasing id.

Type Aliases§

  • The element type of the set.