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]));
}
- Added
FromIterator<(K, Vec<V>)>
#48.
- Fixes a bug where iteration would panic on empty (inner) vectors #46.
- Added
flat_iter
andflat_iter_mut
- Fixed bug where
get
andget_mut
could panic.
multimap!
macro fixes; allow trailing comma, naming hygiene and create with enough capacity for all elements.
- Added
#![forbid(unsafe_code)]
.
- Fixed wrong link to documentation in
Cargo.toml
.
- Added
MultiMap::insert_many
. - Added
MultiMap::insert_many_from_slice
.
- Added possibility to replace the default hasher for the underlying
HashMap
. - Fix build warning by removing an unnecessary
mut
.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT) at your option.
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.