#key-value #hash-map #order #insertion #pair #latest-version

linked-hash-map

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

23 releases

Uses old Rust 2015

0.5.6 Jun 25, 2022
0.5.4 Jan 8, 2021
0.5.3 May 6, 2020
0.5.2 Mar 21, 2019
0.0.2 Mar 26, 2015

#64 in Data structures

Download history 813954/week @ 2024-08-15 837185/week @ 2024-08-22 804236/week @ 2024-08-29 876241/week @ 2024-09-05 821050/week @ 2024-09-12 829676/week @ 2024-09-19 892262/week @ 2024-09-26 919113/week @ 2024-10-03 898266/week @ 2024-10-10 987885/week @ 2024-10-17 946492/week @ 2024-10-24 871611/week @ 2024-10-31 896922/week @ 2024-11-07 920246/week @ 2024-11-14 838440/week @ 2024-11-21 600569/week @ 2024-11-28

3,421,668 downloads per month
Used in 6,193 crates (267 directly)

MIT/Apache

52KB
1K SLoC

Rust CI crates.io

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:

  • fix correctness issues
  • 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://docs.rs/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

~0–335KB