This is a multimap implementation for Rust. Implemented as a thin wrapper around
std::collections::HashMap.
extern crate multimap;
use multimap::MultiMap;
fn main () {
let mut map = MultiMap::new();
map.insert("key1", 42);
map.insert("key1", 1337);
map.insert("key2", 2332);
assert_eq!(map["key1"], 42);
assert_eq!(map.get("key1"), Some(&42));
assert_eq!(map.get_vec("key1"), Some(&vec![42, 1337]));
}
FromIterator<(K, Vec<V>)> #48.flat_iter and flat_iter_mutget and get_mut could panic.multimap! macro fixes; allow trailing comma, naming hygiene and create with
enough capacity for all elements.#![forbid(unsafe_code)].Cargo.toml.MultiMap::insert_many.MultiMap::insert_many_from_slice.HashMap.mut.Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
262 followers · starred Dec 2024
95 followers · starred Aug 2020
286 followers · starred Mar 2021
This is a multimap implementation for Rust. Implemented as a thin wrapper around
std::collections::HashMap.
extern crate multimap;
use multimap::MultiMap;
fn main () {
let mut map = MultiMap::new();
map.insert("key1", 42);
map.insert("key1", 1337);
map.insert("key2", 2332);
assert_eq!(map["key1"], 42);
assert_eq!(map.get("key1"), Some(&42));
assert_eq!(map.get_vec("key1"), Some(&vec![42, 1337]));
}
FromIterator<(K, Vec<V>)> #48.flat_iter and flat_iter_mutget and get_mut could panic.multimap! macro fixes; allow trailing comma, naming hygiene and create with
enough capacity for all elements.#![forbid(unsafe_code)].Cargo.toml.MultiMap::insert_many.MultiMap::insert_many_from_slice.HashMap.mut.Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
262 followers · starred Dec 2024
95 followers · starred Aug 2020
286 followers · starred Mar 2021