Struct ritelinked::linked_hash_map::LinkedHashMap[][src]

pub struct LinkedHashMap<K, V, S = DefaultHashBuilder> { /* fields omitted */ }

A version of HashMap that has a user controllable order for its entries.

It achieves this by keeping its entries in an internal linked list and using a HashMap to point at nodes in this linked list.

The order of entries defaults to “insertion order”, but the user can also modify the order of existing entries by manually moving them to the front or back.

There are two kinds of methods that modify the order of the internal list:

  • Methods that have names like to_front and to_back will unsurprisingly move an existing entry to the front or back
  • Methods that have the word insert will insert a new entry ot the back of the list, and if that method might replace an entry, that method will also move that existing entry to the back.

Implementations

impl<K, V> LinkedHashMap<K, V, DefaultHashBuilder>[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

impl<K, V, S> LinkedHashMap<K, V, S>[src]

pub fn with_hasher(hash_builder: S) -> Self[src]

pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self[src]

pub fn reserve(&mut self, additional: usize)[src]

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>[src]

pub fn shrink_to_fit(&mut self)[src]

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

pub fn is_empty(&self) -> bool[src]

pub fn clear(&mut self)[src]

pub fn iter(&self) -> Iter<'_, K, V>

Notable traits for Iter<'a, K, V>

impl<'a, K, V> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);
[src]

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

Notable traits for IterMut<'a, K, V>

impl<'a, K, V> Iterator for IterMut<'a, K, V> type Item = (&'a K, &'a mut V);
[src]

pub fn drain(&mut self) -> Drain<'_, K, V>

Notable traits for Drain<'a, K, V>

impl<'a, K, V> Iterator for Drain<'a, K, V> type Item = (K, V);
[src]

pub fn keys(&self) -> Keys<'_, K, V>

Notable traits for Keys<'a, K, V>

impl<'a, K, V> Iterator for Keys<'a, K, V> type Item = &'a K;
[src]

pub fn values(&self) -> Values<'_, K, V>

Notable traits for Values<'a, K, V>

impl<'a, K, V> Iterator for Values<'a, K, V> type Item = &'a V;
[src]

pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>

Notable traits for ValuesMut<'a, K, V>

impl<'a, K, V> Iterator for ValuesMut<'a, K, V> type Item = &'a mut V;
[src]

pub fn front(&self) -> Option<(&K, &V)>[src]

pub fn back(&self) -> Option<(&K, &V)>[src]

pub fn retain<F>(&mut self, f: F) where
    F: FnMut(&K, &mut V) -> bool
[src]

pub fn hasher(&self) -> &S[src]

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

impl<K, V, S> LinkedHashMap<K, V, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

pub fn entry(&mut self, key: K) -> Entry<'_, K, V, S>[src]

pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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

Inserts the given key / value pair at the back of the internal linked list.

Returns the previously set value, if one existed prior to this call. After this call, calling LinkedHashMap::back will return a reference to this key / value pair.

pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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

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

impl<K, V, S> LinkedHashMap<K, V, S> where
    S: BuildHasher
[src]

pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S>[src]

pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S>[src]

Trait Implementations

impl<K: Hash + Eq + Clone, V: Clone, S: BuildHasher + Clone> Clone for LinkedHashMap<K, V, S>[src]

impl<K, V, S> Debug for LinkedHashMap<K, V, S> where
    K: Debug,
    V: Debug
[src]

impl<K, V, S> Default for LinkedHashMap<K, V, S> where
    S: Default
[src]

impl<K, V, S> Drop for LinkedHashMap<K, V, S>[src]

impl<K: Hash + Eq, V: Eq, S: BuildHasher> Eq for LinkedHashMap<K, V, S>[src]

impl<'a, K, V, S> Extend<(&'a K, &'a V)> for LinkedHashMap<K, V, S> where
    K: 'a + Hash + Eq + Copy,
    V: 'a + Copy,
    S: BuildHasher
[src]

impl<K: Hash + Eq, V, S: BuildHasher> Extend<(K, V)> for LinkedHashMap<K, V, S>[src]

impl<K: Hash + Eq, V, S: BuildHasher + Default> FromIterator<(K, V)> for LinkedHashMap<K, V, S>[src]

impl<K: Hash + Eq, V: Hash, S: BuildHasher> Hash for LinkedHashMap<K, V, S>[src]

impl<'a, K, V, S, Q: ?Sized> Index<&'a Q> for LinkedHashMap<K, V, S> where
    K: Hash + Eq + Borrow<Q>,
    S: BuildHasher,
    Q: Eq + Hash
[src]

type Output = V

The returned type after indexing.

impl<'a, K, V, S, Q: ?Sized> IndexMut<&'a Q> for LinkedHashMap<K, V, S> where
    K: Hash + Eq + Borrow<Q>,
    S: BuildHasher,
    Q: Eq + Hash
[src]

impl<'a, K, V, S> IntoIterator for &'a LinkedHashMap<K, V, S>[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

impl<'a, K, V, S> IntoIterator for &'a mut LinkedHashMap<K, V, S>[src]

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.

type IntoIter = IterMut<'a, K, V>

Which kind of iterator are we turning this into?

impl<K, V, S> IntoIterator for LinkedHashMap<K, V, S>[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?

impl<K: Hash + Eq + Ord, V: Ord, S: BuildHasher> Ord for LinkedHashMap<K, V, S>[src]

impl<K: Hash + Eq, V: PartialEq, S: BuildHasher> PartialEq<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S>[src]

impl<K: Hash + Eq + PartialOrd, V: PartialOrd, S: BuildHasher> PartialOrd<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S>[src]

impl<K: Send, V: Send, S: Send> Send for LinkedHashMap<K, V, S>[src]

impl<K: Sync, V: Sync, S: Sync> Sync for LinkedHashMap<K, V, S>[src]

Auto Trait Implementations

impl<K, V, S> RefUnwindSafe for LinkedHashMap<K, V, S> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V, S> Unpin for LinkedHashMap<K, V, S> where
    S: Unpin

impl<K, V, S> UnwindSafe for LinkedHashMap<K, V, S> where
    K: RefUnwindSafe,
    S: UnwindSafe,
    V: RefUnwindSafe

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> CallHasher for T where
    T: Hash
[src]

impl<T> CallHasher for T where
    T: Hash + ?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.