15 releases (9 breaking)

Uses old Rust 2015

0.10.1 May 11, 2025
0.10.0 Jan 15, 2024
0.9.1 Oct 23, 2023
0.9.0 Mar 21, 2023
0.1.0 Apr 24, 2015

#40 in Data structures

Download history 1224506/week @ 2025-02-01 1357505/week @ 2025-02-08 1357533/week @ 2025-02-15 1348979/week @ 2025-02-22 1657922/week @ 2025-03-01 1667770/week @ 2025-03-08 1805870/week @ 2025-03-15 2103898/week @ 2025-03-22 1474835/week @ 2025-03-29 1552808/week @ 2025-04-05 1333166/week @ 2025-04-12 1290954/week @ 2025-04-19 1224450/week @ 2025-04-26 1325307/week @ 2025-05-03 1342722/week @ 2025-05-10 1135147/week @ 2025-05-17

5,260,581 downloads per month
Used in 2,546 crates (106 directly)

MIT/Apache

56KB
1K SLoC

crates.io docs.rs

Multimap implementation for Rust

This is a multimap implementation for Rust. Implemented as a thin wrapper around std::collections::HashMap.

Example

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]));
}

Changelog

0.10.1

  • Fix docs for flat_iter #45
  • Clippy warnings

0.10.0

  • Added FromIterator<(K, Vec<V>)> #48.

0.9.1

  • Fixes a bug where iteration would panic on empty (inner) vectors #46.

0.9.0

  • Added flat_iter and flat_iter_mut
  • Fixed bug where get and get_mut could panic.

0.8.3

  • multimap! macro fixes; allow trailing comma, naming hygiene and create with enough capacity for all elements.

0.8.2

  • Added #![forbid(unsafe_code)].

0.8.1

  • Fixed wrong link to documentation in Cargo.toml.

0.8.0

  • Added MultiMap::insert_many.
  • Added MultiMap::insert_many_from_slice.

0.7.0

  • Added possibility to replace the default hasher for the underlying HashMap.
  • Fix build warning by removing an unnecessary mut.

License

Licensed under either of

Contribution

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.

Dependencies

~150KB