#hash-map #key-value #linked #pair #data-structures #wrapper #insertion

terminal-linked-hash-map

A fork of linked-hash-map that builds on stable in exchange for not allowing custom hashers

1 unstable release

Uses old Rust 2015

0.1.0 Jan 9, 2016

#22 in #linked


Used in tfs

MIT/Apache

28KB
538 lines

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

Documentation is available at https://contain-rs.github.io/linked-hash-map/linked_hash_map.


lib.rs:

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

Examples

use terminal_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)]);

No runtime deps