Struct ordered_map::OrderedMap[][src]

pub struct OrderedMap<K, V, C> { /* fields omitted */ }

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

impl<'a, K: 'a, V: 'a, C: 'a> OrderedMap<K, V, C> where
    K: Eq + Hash + Copy,
    C: PartialOrd
[src]

pub fn new(extract_comparable: fn(_: &V) -> C) -> Self[src]

The function extract_comparable is used to convert the value of type &V to something comparable of type C

pub fn len(&self) -> usize[src]

pub fn descending_keys(&'a self) -> DescendingKeys<'a, K, C>

Notable traits for DescendingKeys<'a, K, C>

impl<'a, K: 'a, C: 'a> Iterator for DescendingKeys<'a, K, C> type Item = &'a K;
[src]

Keys of this map in descending order

pub fn descending_values(&'a self) -> DescendingValues<'a, K, V, C>

Notable traits for DescendingValues<'a, K, V, C>

impl<'a, K, V, C> Iterator for DescendingValues<'a, K, V, C> where
    K: Eq + Hash
type Item = &'a V;
[src]

Values of this map in descending order

pub fn descending_items(&'a self) -> DescendingItems<'a, K, V, C>

Notable traits for DescendingItems<'a, K, V, C>

impl<'a, K, V, C> Iterator for DescendingItems<'a, K, V, C> where
    K: Eq + Hash
type Item = (&'a K, &'a V);
[src]

(K, V) pairs of this map in descending order

pub fn insert(&mut self, k: K, v: V) -> Option<V>[src]

Insert a new key-value pair to the map, the old value is returned as Option<V>

pub fn remove(&mut self, k: &K) -> Option<V>[src]

Remove a key-value pair from the map

Trait Implementations

impl<K: Clone, V: Clone, C: Clone> Clone for OrderedMap<K, V, C>[src]

impl<K: Debug, V: Debug, C: Debug> Debug for OrderedMap<K, V, C>[src]

Auto Trait Implementations

impl<K, V, C> RefUnwindSafe for OrderedMap<K, V, C> where
    C: RefUnwindSafe,
    K: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<K, V, C> Send for OrderedMap<K, V, C> where
    C: Send,
    K: Send,
    V: Send
[src]

impl<K, V, C> Sync for OrderedMap<K, V, C> where
    C: Sync,
    K: Sync,
    V: Sync
[src]

impl<K, V, C> Unpin for OrderedMap<K, V, C> where
    C: Unpin,
    K: Unpin,
    V: Unpin
[src]

impl<K, V, C> UnwindSafe for OrderedMap<K, V, C> where
    C: UnwindSafe,
    K: UnwindSafe,
    V: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,