| 1 | # `bimap-rs` |
| 2 | |
| 3 | <!-- badges --> |
| 4 | [![version][version badge]][lib.rs] |
| 5 | [![documentation][documentation badge]][docs.rs] |
| 6 | [![license][license badge]](#license) |
| 7 | |
| 8 | |
| 9 | `bimap-rs` is a pure Rust library for dealing with bijective maps, aiming to |
| 10 | feel like an extension of the standard library's data structures whenever |
| 11 | possible. There are no external dependencies by default but [Serde] and |
| 12 | [`no_std`] compatibility are available through feature flags. |
| 13 | |
| 14 | 1. [Quick start](#quick-start) |
| 15 | 1. [Feature flags](#feature-flags) |
| 16 | 1. [Documentation](#documentation) |
| 17 | 1. [Contributing](#contributing) |
| 18 | 1. [Semantic versioning](#semantic-versioning) |
| 19 | 1. [Minimum supported Rust version](#minimum-supported-rust-version) |
| 20 | 1. [License](#license) |
| 21 | |
| 22 | ## Quick start |
| 23 | |
| 24 | To use the latest version of `bimap-rs` with the default features, add this to |
| 25 | your project's `Cargo.toml` file: |
| 26 | |
| 27 | ```toml |
| 28 | [dependencies] |
| 29 | bimap = "0.6.3" |
| 30 | ``` |
| 31 | |
| 32 | You can now run the `bimap-rs` Hello World! |
| 33 | |
| 34 | ```rust |
| 35 | fn main() { |
| 36 | // A bijective map between letters of the English alphabet and their positions. |
| 37 | let mut alphabet = bimap::BiMap::<char, u8>::new(); |
| 38 | |
| 39 | alphabet.insert('A', 1); |
| 40 | // ... |
| 41 | alphabet.insert('Z', 26); |
| 42 | |
| 43 | println!("A is at position {}", alphabet.get_by_left(&'A').unwrap()); |
| 44 | println!("{} is at position 26", alphabet.get_by_right(&26).unwrap()); |
| 45 | } |
| 46 | ``` |
| 47 | |
| 48 | ## Feature flags |
| 49 | |
| 50 | | Flag name | Description | Enabled by default? | |
| 51 | | --- | --- | --- | |
| 52 | | `std` | Standard library usage (`HashMap`) | yes | |
| 53 | | `serde` | (De)serialization using [Serde] | no | |
| 54 | |
| 55 | This `Cargo.toml` shows how these features can be enabled and disabled. |
| 56 | |
| 57 | ```toml |
| 58 | [dependencies] |
| 59 | # I just want to use `bimap-rs`. |
| 60 | bimap = "0.6.3" |
| 61 | |
| 62 | # I want to use `bimap-rs` without the Rust standard library. |
| 63 | bimap = { version = "0.6.3", default-features = false } |
| 64 | |
| 65 | # I want to use `bimap-rs` with Serde support. |
| 66 | bimap = { version = "0.6.3", features = ["serde"] } |
| 67 | ``` |
| 68 | |
| 69 | ## Documentation |
| 70 | |
| 71 | Documentation for the latest version of `bimap-rs` is available on [docs.rs]. |
| 72 | |
| 73 | ## Contributing |
| 74 | |
| 75 | Thank you for your interest in improving `bimap-rs`! Please read the [code of |
| 76 | conduct] and the [contributing guidelines] before submitting an issue or |
| 77 | opening a pull request. |
| 78 | |
| 79 | ## Semantic versioning |
| 80 | |
| 81 | `bimap-rs` adheres to the de-facto Rust variety of Semantic Versioning. |
| 82 | |
| 83 | ## Minimum supported Rust version |
| 84 | |
| 85 | | `bimap` | MSRV | |
| 86 | | --- | --- | |
| 87 | | v0.6.3 | 1.56.1 | |
| 88 | | v0.6.2 | 1.56.1 | |
| 89 | | v0.6.1 | 1.42.0 | |
| 90 | | v0.6.0 | 1.38.0 | |
| 91 | | v0.5.3 | 1.38.0 | |
| 92 | | v0.5.2 | 1.38.0 | |
| 93 | | v0.5.1 | 1.38.0 | |
| 94 | | v0.5.0 | 1.38.0 | |
| 95 | | v0.4.0 | 1.38.0 | |
| 96 | |
| 97 | ## License |
| 98 | |
| 99 | `bimap-rs` is dual-licensed under the [Apache License] and the [MIT License]. |
| 100 | As a library user, this means that you are free to choose either license when |
| 101 | using `bimap-rs`. As a library contributor, this means that any work you |
| 102 | contribute to `bimap-rs` will be similarly dual-licensed. |
| 103 | |
| 104 | <!-- external links --> |
| 105 | [docs.rs]: https://docs.rs/bimap/ |
| 106 | [lib.rs]: https://lib.rs/crates/bimap |
| 107 | [`no_std`]: https://rust-embedded.github.io/book/intro/no-std.html |
| 108 | [Serde]: https://serde.rs/ |
| 109 | |
| 110 | <!-- local files --> |
| 111 | [Apache License]: LICENSE_APACHE |
| 112 | [code of conduct]: CODE_OF_CONDUCT.md |
| 113 | [contributing guidelines]: CONTRIBUTING.md |
| 114 | [MIT License]: LICENSE_MIT |
| 115 | |
| 116 | <!-- static badge images (all purple) --> |
| 117 | [documentation badge]: https://img.shields.io/static/v1?label=documentation&message=docs.rs&color=blueviolet |
| 118 | [license badge]: https://img.shields.io/static/v1?label=license&message=Apache-2.0/MIT&color=blueviolet |
| 119 | [version badge]: https://img.shields.io/static/v1?label=latest%20version&message=lib.rs&color=blueviolet |