[][src]Struct hashlink::linked_hash_map::LinkedHashMap

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.

Methods

impl<K, V> LinkedHashMap<K, V>[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<(), CollectionAllocErr>
[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]

Important traits for Iter<'a, K, V>
pub fn iter(&self) -> Iter<K, V>[src]

Important traits for IterMut<'a, K, V>
pub fn iter_mut(&mut self) -> IterMut<K, V>[src]

Important traits for Drain<'a, K, V>
pub fn drain(&mut self) -> Drain<K, V>[src]

Important traits for Keys<'a, K, V>
pub fn keys(&self) -> Keys<K, V>[src]

Important traits for Values<'a, K, V>
pub fn values(&self) -> Values<K, V>[src]

Important traits for ValuesMut<'a, K, V>
pub fn values_mut(&mut self) -> ValuesMut<K, 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 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 + 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: Hash + Eq, V: PartialEq, S: BuildHasher> PartialEq<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S>[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

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

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

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<'a, K: Hash + Eq, V, S: BuildHasher> 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: Hash + Eq, V, S: BuildHasher> 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: Hash + Eq, V, S: BuildHasher> 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, V: Eq, S: BuildHasher> Eq for LinkedHashMap<K, V, S>[src]

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

impl<K: Hash + Eq, V, S: BuildHasher> Extend<(K, V)> 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, V, S> Default for LinkedHashMap<K, V, S> where
    S: Default
[src]

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

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

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: Debug + Hash + Eq, B: Debug, S: BuildHasher> Debug for LinkedHashMap<A, B, S>[src]

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

Auto Trait Implementations

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

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

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

Blanket Implementations

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

type Owned = T

The resulting type after obtaining ownership.

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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