Expand description
§Keyed Set: a hashbrown-based HashSet that indexes based on projections of its elements.
Ever wanted a HashMap<K, V>
, but where V
actually contains K
(or at least can be projected to it)?
Well this is it.
The easiest way to define a projection is through a closure that you pass at construction, but you may also define your own key extractors as ZSTs that implement Default
to gain a Default
constructor for your Keyed Sets.
Structs§
- The default way to borrow a value.
- An iterator over a
KeyedSet
that steals the values from it. - An iterator over a
KeyedSet
that only steals values that match a given predicate. - An iterator over the
KeyedSet
by value. - An iterator over the
KeyedSet
by reference. - An iterator over the
KeyedSet
by mutable reference. - A
HashMap<K, V>
whereK
is a part ofV
- A guard that allows mutating a value, but which panics if the new value once dropped doesn’t have the same key.
- A vacant entry into a
KeyedSet
Enums§
- An entry into a
KeyedSet
, allowing in-place modification of the value associated with the key if it exists.
Traits§
- Allows defining alternatives to
core::ops::Deref
- The trait magic that allows
KeyedSet::entry
to work. - Extracts the key from the value, allowing
KeyedSet
to obtain its values’ keys.