Trait Equivalent
pub trait Equivalent<K: ?Sized>
Key equivalence trait.
This trait defines the function used to compare the input value with the
map keys (or set values) during a lookup operation such as HashMap::get
or HashSet::contains.
It is provided with a blanket implementation based on the
Borrow trait.
Correctness
Equivalent values must hash to the same value.
Required Methods
fn equivalent(&self, key: &K) -> boolChecks if this value is equivalent to the given key.
Returns
trueif both values are equivalent, andfalseotherwise.Correctness
When this function returns
true, bothselfandkeymust hash to the same value.
Implementors
impl<Q, K> Equivalent<K> for HashMap<K, V, S, A> where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,impl<Q, K> Equivalent<K> for HashSet<T, S, A> where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,impl<Q, K> Equivalent<K> for Q where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,impl<Q, K> Equivalent<K> for TryReserveError where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,