| 1 | [](https://crates.io/crates/multimap) |
| 2 | [](https://docs.rs/multimap) |
| 3 | |
| 4 | # Multimap implementation for Rust |
| 5 | |
| 6 | This is a multimap implementation for Rust. Implemented as a thin wrapper around |
| 7 | `std::collections::HashMap`. |
| 8 | |
| 9 | ## Example |
| 10 | |
| 11 | ````rust |
| 12 | extern crate multimap; |
| 13 | |
| 14 | use multimap::MultiMap; |
| 15 | |
| 16 | fn main () { |
| 17 | let mut map = MultiMap::new(); |
| 18 | |
| 19 | map.insert("key1", 42); |
| 20 | map.insert("key1", 1337); |
| 21 | map.insert("key2", 2332); |
| 22 | |
| 23 | assert_eq!(map["key1"], 42); |
| 24 | assert_eq!(map.get("key1"), Some(&42)); |
| 25 | assert_eq!(map.get_vec("key1"), Some(&vec![42, 1337])); |
| 26 | } |
| 27 | ```` |
| 28 | |
| 29 | ## Changelog |
| 30 | |
| 31 | ### 0.10.1 |
| 32 | |
| 33 | * Fix docs for flat_iter #45 |
| 34 | * Clippy warnings |
| 35 | |
| 36 | ### 0.10.0 |
| 37 | |
| 38 | * Added `FromIterator<(K, Vec<V>)>` [#48](https://github.com/havarnov/multimap/pull/48). |
| 39 | |
| 40 | ### 0.9.1 |
| 41 | |
| 42 | * Fixes a bug where iteration would panic on empty (inner) vectors [#46](https://github.com/havarnov/multimap/issues/46). |
| 43 | |
| 44 | ### 0.9.0 |
| 45 | |
| 46 | * Added ```flat_iter``` and ```flat_iter_mut``` |
| 47 | * Fixed bug where ```get``` and ```get_mut``` could panic. |
| 48 | |
| 49 | ### 0.8.3 |
| 50 | |
| 51 | * `multimap!` macro fixes; allow trailing comma, naming hygiene and create with |
| 52 | enough capacity for all elements. |
| 53 | |
| 54 | ### 0.8.2 |
| 55 | |
| 56 | * Added ```#![forbid(unsafe_code)]```. |
| 57 | |
| 58 | ### 0.8.1 |
| 59 | |
| 60 | * Fixed wrong link to documentation in `Cargo.toml`. |
| 61 | |
| 62 | ### 0.8.0 |
| 63 | |
| 64 | * Added ```MultiMap::insert_many```. |
| 65 | * Added ```MultiMap::insert_many_from_slice```. |
| 66 | |
| 67 | ### 0.7.0 |
| 68 | |
| 69 | * Added possibility to replace the default hasher for the underlying |
| 70 | ```HashMap```. |
| 71 | * Fix build warning by removing an unnecessary ```mut```. |
| 72 | |
| 73 | ## License |
| 74 | |
| 75 | Licensed under either of |
| 76 | * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or |
| 77 | https://www.apache.org/licenses/LICENSE-2.0) |
| 78 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or |
| 79 | https://opensource.org/licenses/MIT) |
| 80 | at your option. |
| 81 | |
| 82 | ### Contribution |
| 83 | |
| 84 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 85 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 86 | dual licensed as above, without any additional terms or conditions. |