Skip to content

Commit ce14341

Browse files
committed
Add a README
1 parent c06bef4 commit ce14341

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
8+
These may be used in the implementation of maps where the lookup type `Q`
9+
may 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+
16+
These traits are not used by the maps in the standard library, but they may
17+
add more flexibility in third-party map implementations, especially in
18+
situations where a strict `K: Borrow<Q>` relationship is not available.
19+
20+
## License
21+
22+
Equivalent is distributed under the terms of both the MIT license and the
23+
Apache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and
24+
[LICENSE-MIT](LICENSE-MIT) for details. Opening a pull request is
25+
assumed to signal agreement with these licensing terms.

0 commit comments

Comments
 (0)