1# Equivalent
2
3[![crates.io](https://img.shields.io/crates/v/equivalent.svg)](https://crates.io/crates/equivalent)
4[![docs](https://docs.rs/equivalent/badge.svg)](https://docs.rs/equivalent)
5
6`Equivalent` and `Comparable` are Rust traits for key comparison in maps.
7
8These may be used in the implementation of maps where the lookup type `Q`
9may be different than the stored key type `K`.
10
11* `Q: Equivalent<K>` checks for equality, similar to the `HashMap<K, V>`
12  constraint `K: Borrow<Q>, Q: Eq`.
13* `Q: Comparable<K>` checks the ordering, similar to the `BTreeMap<K, V>`
14  constraint `K: Borrow<Q>, Q: Ord`.
15
16These traits are not used by the maps in the standard library, but they may
17add more flexibility in third-party map implementations, especially in
18situations where a strict `K: Borrow<Q>` relationship is not available.
19
20## License
21
22Equivalent is distributed under the terms of both the MIT license and the
23Apache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and
24[LICENSE-MIT](LICENSE-MIT) for details. Opening a pull request is
25assumed to signal agreement with these licensing terms.
26