16 unstable releases (5 breaking)

0.6.1 Apr 8, 2021
0.6.0 Jan 4, 2021
0.5.3 Oct 30, 2020
0.5.2 Jul 26, 2020
0.1.3 Sep 13, 2017

#16 in Data structures

Download history 1203/week @ 2020-12-25 2994/week @ 2021-01-01 3481/week @ 2021-01-08 2370/week @ 2021-01-15 3879/week @ 2021-01-22 3406/week @ 2021-01-29 4731/week @ 2021-02-05 5409/week @ 2021-02-12 6841/week @ 2021-02-19 10280/week @ 2021-02-26 11917/week @ 2021-03-05 8564/week @ 2021-03-12 8103/week @ 2021-03-19 7480/week @ 2021-03-26 6361/week @ 2021-04-02 6204/week @ 2021-04-09

26,872 downloads per month
Used in 44 crates (16 directly)

Apache-2.0/MIT

93KB
1.5K SLoC

bimap-rs

version documentation license

bimap-rs is a pure Rust library for dealing with bijective maps, aiming to feel like an extension of the standard library's data structures whenever possible. There are no external dependencies by default but Serde and no_std compatibility are available through feature flags.

  1. Quick start
  2. Feature flags
  3. Documentation
  4. Contributing
  5. Semantic versioning
  6. License

Quick start

To use the latest version of bimap-rs with the default features, add this to your project's Cargo.toml file:

[dependencies]
bimap = "0.6.1"

You can now run the bimap-rs Hello World!

fn main() {
    // A bijective map between letters of the English alphabet and their positions.
    let mut alphabet = bimap::BiMap::<char, u8>::new();

    alphabet.insert('A', 1);
    // ...
    alphabet.insert('Z', 26);

    println!("A is at position {}", alphabet.get_by_left(&'A').unwrap());
    println!("{} is at position 26", alphabet.get_by_right(&26).unwrap());
}

Feature flags

Flag name Description Enabled by default?
std Standard library usage (HashMap) yes
serde (De)serialization using Serde no

This Cargo.toml shows how these features can be enabled and disabled.

[dependencies]
# I just want to use `bimap-rs`.
bimap = "0.6.1"

# I want to use `bimap-rs` without the Rust standard library.
bimap = { version = "0.6.1", default-features = false }

# I want to use `bimap-rs` with Serde support.
bimap = { version = "0.6.1", features = ["serde"] }

Documentation

Documentation for the latest version of bimap-rs is available on docs.rs.

Contributing

Thank you for your interest in improving bimap-rs! Please read the code of conduct and the contributing guidelines before submitting an issue or opening a pull request.

Semantic versioning

bimap-rs adheres to the de-facto Rust variety of Semantic Versioning.

License

bimap-rs is dual-licensed under the Apache License and the MIT License. As a library user, this means that you are free to choose either license when using bimap-rs. As a library contributor, this means that any work you contribute to bimap-rs will be similarly dual-licensed.

Dependencies