File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments