#data-structures

linked-hash-map

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

19 releases

0.5.2 Mar 21, 2019
0.5.1 Jan 29, 2018
0.5.0 Jul 26, 2017
0.4.2 Mar 29, 2017
0.0.2 Mar 26, 2015

#12 in Data structures

Download history 78701/week @ 2019-12-17 46969/week @ 2019-12-24 61839/week @ 2019-12-31 92947/week @ 2020-01-07 93214/week @ 2020-01-14 97096/week @ 2020-01-21 100323/week @ 2020-01-28 99197/week @ 2020-02-04 92788/week @ 2020-02-11 96752/week @ 2020-02-18 97092/week @ 2020-02-25 100308/week @ 2020-03-03 101875/week @ 2020-03-10 106539/week @ 2020-03-17 110429/week @ 2020-03-24 103593/week @ 2020-03-31

359,262 downloads per month
Used in 1,608 crates (92 directly)

MIT/Apache

46KB
935 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

~120KB