pub struct OrderedMap<K, V, C> { /* private fields */ }
Expand description
An OrderedMap
is like a std::collections::HashMap
,
but it is sorted according to the value in descending order.
It doesn’t require the value of the map, V
, to be comparable,
the comparison of the value is done on C
,
which is the return value of extract_comparable(&V)
.
Implementations§
Source§impl<'a, K, V: 'a, C> OrderedMap<K, V, C>
impl<'a, K, V: 'a, C> OrderedMap<K, V, C>
Sourcepub fn new(extract_comparable: fn(&V) -> C) -> Self
pub fn new(extract_comparable: fn(&V) -> C) -> Self
The function extract_comparable
is used to convert the value of type &V
to something comparable of type C
pub fn len(&self) -> usize
Sourcepub fn descending_keys(&'a self) -> DescendingKeys<'a, K, C> ⓘ
pub fn descending_keys(&'a self) -> DescendingKeys<'a, K, C> ⓘ
Keys of this map in descending order
Sourcepub fn descending_values(&'a self) -> DescendingValues<'a, K, V, C> ⓘ
pub fn descending_values(&'a self) -> DescendingValues<'a, K, V, C> ⓘ
Values of this map in descending order
Sourcepub fn descending_items(&'a self) -> DescendingItems<'a, K, V, C> ⓘ
pub fn descending_items(&'a self) -> DescendingItems<'a, K, V, C> ⓘ
(K, V) pairs of this map in descending order
Trait Implementations§
Auto Trait Implementations§
impl<K, V, C> Freeze for OrderedMap<K, V, C>
impl<K, V, C> RefUnwindSafe for OrderedMap<K, V, C>
impl<K, V, C> Send for OrderedMap<K, V, C>
impl<K, V, C> Sync for OrderedMap<K, V, C>
impl<K, V, C> Unpin for OrderedMap<K, V, C>
impl<K, V, C> UnwindSafe for OrderedMap<K, V, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more