bidimap
bidimap 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.
This is a maintained fork of bimap.
Quick start
To use the latest version of bidimap with the default features, add this to
your project's Cargo.toml file:
[]
= "0.7"
You can now run the bidimap Hello World!
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.
[]
# I just want to use `bidimap`.
= "0.7"
# I want to use `bidimap` without the Rust standard library.
= { = "0.7", = false }
# I want to use `bidimap` with Serde support.
= { = "0.7", = ["serde"] }
Custom hashers
BiHashMap supports custom hashers for each side of the bimap independently,
just like the standard library's HashMap. This is useful when you want to use
a faster or deterministic hasher such as fnv
or ahash.
use BiHashMap;
use RandomState;
let s_left = new;
let s_right = new;
let mut bimap = with_hashers;
bimap.insert;
See BiHashMap::with_hashers and
BiHashMap::with_capacity_and_hashers for details.
Documentation
Documentation for the latest version of bidimap is available on docs.rs.
Semantic versioning
bidimap adheres to the de-facto Rust variety of Semantic Versioning.
Minimum supported Rust version
bidimap |
MSRV |
|---|---|
| v0.7.0 | 1.85.0 |
License
bidimap 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 bidimap. As a library contributor, this means that any work you
contribute to bidimap will be similarly dual-licensed.