#data-structures

linked-hash-map

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

20 releases

0.5.1 Jan 29, 2018
0.5.0 Jul 26, 2017
0.4.2 Mar 29, 2017
0.3.0 Aug 10, 2016
0.0.2 Mar 26, 2015

#7 in Data structures

Download history 12637/week @ 2018-05-06 16332/week @ 2018-05-13 16355/week @ 2018-05-20 15323/week @ 2018-05-27 14736/week @ 2018-06-03 16827/week @ 2018-06-10 16453/week @ 2018-06-17 18120/week @ 2018-06-24 15664/week @ 2018-07-01 16883/week @ 2018-07-08 18932/week @ 2018-07-15 18352/week @ 2018-07-22 16071/week @ 2018-07-29

58,436 downloads per month
Used in 449 crates (53 directly)

MIT/Apache

46KB
946 lines

WARNING: THIS PROJECT IS IN MAINTENANCE MODE, DUE TO INSUFFICIENT MAINTAINER RESOURCES

It works fine, but will generally no longer be improved.

We are currently only accepting changes which:

  • keep this compiling with the latest versions of Rust or its dependencies.
  • have minimal review requirements, such as documentation changes (so not totally new APIs).

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

Dependencies

~613KB