[][src]Crate linked_hash_map

A HashMap wrapper that holds key-value pairs in insertion order.

Examples

use linked_hash_map::LinkedHashMap;

let mut map = LinkedHashMap::new();
map.insert(2, 20);
map.insert(1, 10);
map.insert(3, 30);
assert_eq!(map[&1], 10);
assert_eq!(map[&2], 20);
assert_eq!(map[&3], 30);

let items: Vec<(i32, i32)> = map.iter().map(|t| (*t.0, *t.1)).collect();
assert_eq!(items, [(2, 20), (1, 10), (3, 30)]);

Structs

Entries

An insertion-order iterator over a LinkedHashMap's entries represented as an OccupiedEntry.

IntoIter

A consuming insertion-order iterator over a LinkedHashMap's entries.

Iter

An insertion-order iterator over a LinkedHashMap's entries, with immutable references to the values.

IterMut

An insertion-order iterator over a LinkedHashMap's entries, with mutable references to the values.

Keys

An insertion-order iterator over a LinkedHashMap's keys.

LinkedHashMap

A linked hash map.

OccupiedEntry

A view into a single occupied location in a LinkedHashMap.

VacantEntry

A view into a single empty location in a LinkedHashMap.

Values

An insertion-order iterator over a LinkedHashMap's values.

Enums

Entry

A view into a single location in a map, which may be vacant or occupied.