#hash-table #hash-map #associative-array #multi-key

multi_key_map

a hash table that shares one value across multiple keys

3 releases (breaking)

0.3.0 Feb 19, 2023
0.2.0 Feb 19, 2023
0.1.0 Feb 16, 2023

#1941 in Data structures

Download history 8/week @ 2024-09-23 2/week @ 2024-10-07 55/week @ 2024-10-21 9/week @ 2024-10-28 6/week @ 2024-11-04

70 downloads per month

BSD-3-Clause-Clear

24KB
563 lines

a hash table that shares one value across multiple keys.


lib.rs:

Provides [MultiKeyMap], an associative array that can share one value across multiple keys without Rc, and provides mutable access that will never panic at runtime, unlike RefCell.

use multi_key_map::MultiKeyMap;

let mut map: MultiKeyMap<i32, String> = MultiKeyMap::from([
    (vec![1, 2, 3], "foo".into()),
    (vec![4, 5], "bar".into()),
]);
map.insert_many(vec![6, 7], "quux".into());
map.alias(&7, 8);
assert_eq!(map.get(&8), Some(&String::from("quux")));

No runtime deps