Crate id_map [] [src]

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

IdMap

A container that gives each item a unique id. Internally all elements are stored contiguously.

Ids

An iterator over all ids, in increasing order.

IntoIter

A consuming iterator over id-value pairs, in order of increasing id.

Iter

An iterator over id-value pairs, in order of increasing id.

IterMut

A mutable iterator over id-value pairs, in order of increasing id.

Values

An iterator over all values, in order of increasing id.

ValuesMut

A mutable iterator over all values, in order of increasing id.

Type Definitions

Id

The element type of the set.