rune::alloc::hashbrown

Trait Equivalent

Source
pub trait Equivalent<K>
where K: ?Sized,
{ // Required method fn equivalent(&self, key: &K) -> bool; }
Expand description

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§

Source

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key.

Returns true if both values are equivalent, and false otherwise.

§Correctness

When this function returns true, both self and key must hash to the same value.

Implementors§

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,