Crate multi_key_map

Source
Expand description

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

Re-exports§

pub use entry::Entry;
pub use entry::OccupiedEntry;
pub use entry::VacantEntry;
pub use iter::Iter;

Modules§

entry
Provides types and methods for the Entry API. for more information, see entry for more info.
iter
Provides Iter, an iterator over all keys and values. see iter for more info.

Structs§

MultiKeyMap
A wrapper over HashMap that allows for multiple keys to point to a single element, providing some additional utilities to make working with multiple keys easier.