Struct ritelinked::linked_hash_map::LinkedHashMap [−][src]
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
andto_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>ⓘ
[src]
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘ
[src]
pub fn drain(&mut self) -> Drain<'_, K, V>ⓘ
[src]
pub fn keys(&self) -> Keys<'_, K, V>ⓘ
[src]
pub fn values(&self) -> Values<'_, K, V>ⓘ
[src]
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]
F: FnMut(&K, &mut V) -> bool,
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]
K: Eq + Hash,
S: BuildHasher,
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]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
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]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
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]
S: BuildHasher,
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]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K, V, S> Debug for LinkedHashMap<K, V, S> where
K: Debug,
V: Debug,
[src]
K: Debug,
V: Debug,
impl<K, V, S> Default for LinkedHashMap<K, V, S> where
S: Default,
[src]
S: Default,
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]
K: 'a + Hash + Eq + Copy,
V: 'a + Copy,
S: BuildHasher,
fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<K: Hash + Eq, V, S: BuildHasher> Extend<(K, V)> for LinkedHashMap<K, V, S>
[src]
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<K: Hash + Eq, V, S: BuildHasher + Default> FromIterator<(K, V)> for LinkedHashMap<K, V, S>
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]
impl<K: Hash + Eq, V: Hash, S: BuildHasher> Hash for LinkedHashMap<K, V, S>
[src]
fn hash<H: Hasher>(&self, h: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
K: Hash + Eq + Borrow<Q>,
S: BuildHasher,
Q: Eq + Hash,
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]
K: Hash + Eq + Borrow<Q>,
S: BuildHasher,
Q: Eq + Hash,
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?
fn into_iter(self) -> Iter<'a, K, V>ⓘ
[src]
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?
fn into_iter(self) -> IterMut<'a, K, V>ⓘ
[src]
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?
fn into_iter(self) -> IntoIter<K, V>ⓘ
[src]
impl<K: Hash + Eq + Ord, V: Ord, S: BuildHasher> Ord for LinkedHashMap<K, V, S>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[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]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn lt(&self, other: &Self) -> bool
[src]
fn le(&self, other: &Self) -> bool
[src]
fn ge(&self, other: &Self) -> bool
[src]
fn gt(&self, other: &Self) -> bool
[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> Unpin for LinkedHashMap<K, V, S> where
S: Unpin,
S: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
[src]
T: Hash,
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
T: Hash + ?Sized,
pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
H: Hash + ?Sized,
B: BuildHasher,
[src]
H: Hash + ?Sized,
B: BuildHasher,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,