[][src]Struct ordered_map::OrderedMap

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 comparision of the value is done on C, which is the return value of extract_comparable(&V).

Methods

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>[src]

Keys of this map in descending order

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

Values of this map in descending order

pub fn descending_items(&'a self) -> DescendingItems<'a, K, V, C>[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

Auto Trait Implementations

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

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

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

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

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

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, 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>,