Struct actix_tools::sentry::sentry_client::protocol::map::LinkedHashMap [−]
pub struct LinkedHashMap<K, V, S = RandomState> { /* fields omitted */ }
A linked hash map.
Methods
impl<K, V> LinkedHashMap<K, V, RandomState> where
K: Eq + Hash,
impl<K, V> LinkedHashMap<K, V, RandomState> where
K: Eq + Hash, pub fn new() -> LinkedHashMap<K, V, RandomState>
pub fn new() -> LinkedHashMap<K, V, RandomState>Creates a linked hash map.
pub fn with_capacity(capacity: usize) -> LinkedHashMap<K, V, RandomState>
pub fn with_capacity(capacity: usize) -> LinkedHashMap<K, V, RandomState>Creates an empty linked hash map with the given initial capacity.
impl<K, V, S> LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
impl<K, V, S> LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, pub fn with_hasher(hash_builder: S) -> LinkedHashMap<K, V, S>
pub fn with_hasher(hash_builder: S) -> LinkedHashMap<K, V, S>Creates an empty linked hash map with the given initial hash builder.
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> LinkedHashMap<K, V, S>
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> LinkedHashMap<K, V, S>Creates an empty linked hash map with the given initial capacity and hash builder.
pub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)Reserves capacity for at least additional more elements to be inserted into the map. The
map may reserve more space to avoid frequent allocations.
Panics
Panics if the new allocation size overflows usize.
pub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)Shrinks the capacity of the map as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
pub fn entry(&mut self, k: K) -> Entry<K, V, S>
pub fn entry(&mut self, k: K) -> Entry<K, V, S>Gets the given key's corresponding entry in the map for in-place manipulation.
Examples
use linked_hash_map::LinkedHashMap; let mut letters = LinkedHashMap::new(); for ch in "a short treatise on fungi".chars() { let counter = letters.entry(ch).or_insert(0); *counter += 1; } assert_eq!(letters[&'s'], 2); assert_eq!(letters[&'t'], 3); assert_eq!(letters[&'u'], 1); assert_eq!(letters.get(&'y'), None);
ⓘImportant traits for Entries<'a, K, V, S>pub fn entries(&mut self) -> Entries<K, V, S>
pub fn entries(&mut self) -> Entries<K, V, S>Returns an iterator visiting all entries in insertion order.
Iterator element type is OccupiedEntry<K, V, S>. Allows for removal
as well as replacing the entry.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert("a", 10); map.insert("c", 30); map.insert("b", 20); { let mut iter = map.entries(); let mut entry = iter.next().unwrap(); assert_eq!(&"a", entry.key()); *entry.get_mut() = 17; } assert_eq!(&17, map.get(&"a").unwrap());
pub fn insert(&mut self, k: K, v: V) -> Option<V>
pub fn insert(&mut self, k: K, v: V) -> Option<V>Inserts a key-value pair into the map. If the key already existed, the old value is returned.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, "a"); map.insert(2, "b"); assert_eq!(map[&1], "a"); assert_eq!(map[&2], "b");
pub fn contains_key<Q>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized,
pub fn contains_key<Q>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized, Checks if the map contains the given key.
pub fn get<Q>(&self, k: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized,
pub fn get<Q>(&self, k: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized, Returns the value corresponding to the key in the map.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, "a"); map.insert(2, "b"); map.insert(2, "c"); map.insert(3, "d"); assert_eq!(map.get(&1), Some(&"a")); assert_eq!(map.get(&2), Some(&"c"));
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized,
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized, Returns the mutable reference corresponding to the key in the map.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, "a"); map.insert(2, "b"); *map.get_mut(&1).unwrap() = "c"; assert_eq!(map.get(&1), Some(&"c"));
pub fn get_refresh<Q>(&mut self, k: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized,
pub fn get_refresh<Q>(&mut self, k: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized, Returns the value corresponding to the key in the map.
If value is found, it is moved to the end of the list. This operation can be used in implemenation of LRU cache.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, "a"); map.insert(2, "b"); map.insert(3, "d"); assert_eq!(map.get_refresh(&2), Some(&mut "b")); assert_eq!((&2, &"b"), map.iter().rev().next().unwrap());
pub fn remove<Q>(&mut self, k: &Q) -> Option<V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized,
pub fn remove<Q>(&mut self, k: &Q) -> Option<V> where
K: Borrow<Q>,
Q: Eq + Hash + ?Sized, Removes and returns the value corresponding to the key from the map.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(2, "a"); assert_eq!(map.remove(&1), None); assert_eq!(map.remove(&2), Some("a")); assert_eq!(map.remove(&2), None); assert_eq!(map.len(), 0);
pub fn capacity(&self) -> usize
pub fn capacity(&self) -> usizeReturns the maximum number of key-value pairs the map can hold without reallocating.
Examples
use linked_hash_map::LinkedHashMap; let mut map: LinkedHashMap<i32, &str> = LinkedHashMap::new(); let capacity = map.capacity();
pub fn pop_front(&mut self) -> Option<(K, V)>
pub fn pop_front(&mut self) -> Option<(K, V)>Removes the first entry.
Can be used in implementation of LRU cache.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, 10); map.insert(2, 20); map.pop_front(); assert_eq!(map.get(&1), None); assert_eq!(map.get(&2), Some(&20));
pub fn front(&self) -> Option<(&K, &V)>
pub fn front(&self) -> Option<(&K, &V)>Gets the first entry.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, 10); map.insert(2, 20); assert_eq!(map.front(), Some((&1, &10)));
pub fn pop_back(&mut self) -> Option<(K, V)>
pub fn pop_back(&mut self) -> Option<(K, V)>Removes the last entry.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, 10); map.insert(2, 20); map.pop_back(); assert_eq!(map.get(&1), Some(&10)); assert_eq!(map.get(&2), None);
pub fn back(&mut self) -> Option<(&K, &V)>
pub fn back(&mut self) -> Option<(&K, &V)>Gets the last entry.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert(1, 10); map.insert(2, 20); assert_eq!(map.back(), Some((&2, &20)));
pub fn len(&self) -> usize
pub fn len(&self) -> usizeReturns the number of key-value pairs in the map.
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> boolReturns whether the map is currently empty.
ⓘImportant traits for &'a mut Rpub fn hasher(&self) -> &S
pub fn hasher(&self) -> &SReturns a reference to the map's hasher.
pub fn clear(&mut self)
pub fn clear(&mut self)Clears the map of all key-value pairs.
ⓘImportant traits for Iter<'a, K, V>pub fn iter(&self) -> Iter<K, V>
pub fn iter(&self) -> Iter<K, V>Returns a double-ended iterator visiting all key-value pairs in order of insertion.
Iterator element type is (&'a K, &'a V)
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert("a", 10); map.insert("c", 30); map.insert("b", 20); let mut iter = map.iter(); assert_eq!((&"a", &10), iter.next().unwrap()); assert_eq!((&"c", &30), iter.next().unwrap()); assert_eq!((&"b", &20), iter.next().unwrap()); assert_eq!(None, iter.next());
ⓘImportant traits for IterMut<'a, K, V>pub fn iter_mut(&mut self) -> IterMut<K, V>
pub fn iter_mut(&mut self) -> IterMut<K, V>Returns a double-ended iterator visiting all key-value pairs in order of insertion.
Iterator element type is (&'a K, &'a mut V)
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert("a", 10); map.insert("c", 30); map.insert("b", 20); { let mut iter = map.iter_mut(); let mut entry = iter.next().unwrap(); assert_eq!(&"a", entry.0); *entry.1 = 17; } assert_eq!(&17, map.get(&"a").unwrap());
ⓘImportant traits for Keys<'a, K, V>pub fn keys(&self) -> Keys<K, V>
pub fn keys(&self) -> Keys<K, V>Returns a double-ended iterator visiting all key in order of insertion.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert('a', 10); map.insert('c', 30); map.insert('b', 20); let mut keys = map.keys(); assert_eq!(&'a', keys.next().unwrap()); assert_eq!(&'c', keys.next().unwrap()); assert_eq!(&'b', keys.next().unwrap()); assert_eq!(None, keys.next());
ⓘImportant traits for Values<'a, K, V>pub fn values(&self) -> Values<K, V>
pub fn values(&self) -> Values<K, V>Returns a double-ended iterator visiting all values in order of insertion.
Examples
use linked_hash_map::LinkedHashMap; let mut map = LinkedHashMap::new(); map.insert('a', 10); map.insert('c', 30); map.insert('b', 20); let mut values = map.values(); assert_eq!(&10, values.next().unwrap()); assert_eq!(&30, values.next().unwrap()); assert_eq!(&20, values.next().unwrap()); assert_eq!(None, values.next());
Trait Implementations
impl<'a, K, V, S, Q> IndexMut<&'a Q> for LinkedHashMap<K, V, S> where
K: Hash + Eq + Borrow<Q>,
Q: Eq + Hash + ?Sized,
S: BuildHasher,
impl<'a, K, V, S, Q> IndexMut<&'a Q> for LinkedHashMap<K, V, S> where
K: Hash + Eq + Borrow<Q>,
Q: Eq + Hash + ?Sized,
S: BuildHasher, ⓘImportant traits for &'a mut Rfn index_mut(&mut self, index: &'a Q) -> &mut V
fn index_mut(&mut self, index: &'a Q) -> &mut VPerforms the mutable indexing (container[index]) operation.
impl<'a, K, V, S, Q> Index<&'a Q> for LinkedHashMap<K, V, S> where
K: Hash + Eq + Borrow<Q>,
Q: Eq + Hash + ?Sized,
S: BuildHasher,
impl<'a, K, V, S, Q> Index<&'a Q> for LinkedHashMap<K, V, S> where
K: Hash + Eq + Borrow<Q>,
Q: Eq + Hash + ?Sized,
S: BuildHasher, type Output = V
The returned type after indexing.
ⓘImportant traits for &'a mut Rfn index(&self, index: &'a Q) -> &V
fn index(&self, index: &'a Q) -> &VPerforms the indexing (container[index]) operation.
impl<K, V, S> Send for LinkedHashMap<K, V, S> where
K: Send,
S: Send,
V: Send,
impl<K, V, S> Send for LinkedHashMap<K, V, S> where
K: Send,
S: Send,
V: Send, impl<K, V, S> PartialOrd<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S> where
K: Eq + PartialOrd<K> + Hash,
S: BuildHasher,
V: PartialOrd<V>,
impl<K, V, S> PartialOrd<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S> where
K: Eq + PartialOrd<K> + Hash,
S: BuildHasher,
V: PartialOrd<V>, fn partial_cmp(&self, other: &LinkedHashMap<K, V, S>) -> Option<Ordering>
fn partial_cmp(&self, other: &LinkedHashMap<K, V, S>) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &LinkedHashMap<K, V, S>) -> bool
fn lt(&self, other: &LinkedHashMap<K, V, S>) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &LinkedHashMap<K, V, S>) -> bool
fn le(&self, other: &LinkedHashMap<K, V, S>) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn ge(&self, other: &LinkedHashMap<K, V, S>) -> bool
fn ge(&self, other: &LinkedHashMap<K, V, S>) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
fn gt(&self, other: &LinkedHashMap<K, V, S>) -> bool
fn gt(&self, other: &LinkedHashMap<K, V, S>) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
impl<K, V, S> Extend<(K, V)> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
impl<K, V, S> Extend<(K, V)> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>, Extends a collection with the contents of an iterator. Read more
impl<'a, K, V, S> Extend<(&'a K, &'a V)> for LinkedHashMap<K, V, S> where
K: 'a + Hash + Eq + Copy,
S: BuildHasher,
V: 'a + Copy,
impl<'a, K, V, S> Extend<(&'a K, &'a V)> for LinkedHashMap<K, V, S> where
K: 'a + Hash + Eq + Copy,
S: BuildHasher,
V: 'a + Copy, fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (&'a K, &'a V)>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (&'a K, &'a V)>, Extends a collection with the contents of an iterator. Read more
impl<K, V, S> Hash for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: Hash,
impl<K, V, S> Hash for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: Hash, fn hash<H>(&self, h: &mut H) where
H: Hasher,
fn hash<H>(&self, h: &mut H) where
H: Hasher, Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl<K, V, S> FromIterator<(K, V)> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: Default + BuildHasher,
impl<K, V, S> FromIterator<(K, V)> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: Default + BuildHasher, fn from_iter<I>(iter: I) -> LinkedHashMap<K, V, S> where
I: IntoIterator<Item = (K, V)>,
fn from_iter<I>(iter: I) -> LinkedHashMap<K, V, S> where
I: IntoIterator<Item = (K, V)>, Creates a value from an iterator. Read more
impl<'de, K, V> Deserialize<'de> for LinkedHashMap<K, V, RandomState> where
K: Deserialize<'de> + Eq + Hash,
V: Deserialize<'de>,
impl<'de, K, V> Deserialize<'de> for LinkedHashMap<K, V, RandomState> where
K: Deserialize<'de> + Eq + Hash,
V: Deserialize<'de>, fn deserialize<D>(
deserializer: D
) -> Result<LinkedHashMap<K, V, RandomState>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<LinkedHashMap<K, V, RandomState>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
impl<K, V, S> Clone for LinkedHashMap<K, V, S> where
K: Eq + Clone + Hash,
S: Clone + BuildHasher,
V: Clone,
impl<K, V, S> Clone for LinkedHashMap<K, V, S> where
K: Eq + Clone + Hash,
S: Clone + BuildHasher,
V: Clone, fn clone(&self) -> LinkedHashMap<K, V, S>
fn clone(&self) -> LinkedHashMap<K, V, S>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<K, V, S> Serialize for LinkedHashMap<K, V, S> where
K: Serialize + Eq + Hash,
S: BuildHasher,
V: Serialize,
impl<K, V, S> Serialize for LinkedHashMap<K, V, S> where
K: Serialize + Eq + Hash,
S: BuildHasher,
V: Serialize, fn serialize<T>(
&self,
serializer: T
) -> Result<<T as Serializer>::Ok, <T as Serializer>::Error> where
T: Serializer,
fn serialize<T>(
&self,
serializer: T
) -> Result<<T as Serializer>::Ok, <T as Serializer>::Error> where
T: Serializer, Serialize this value into the given Serde serializer. Read more
impl<K, V, S> Default for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: Default + BuildHasher,
impl<K, V, S> Default for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: Default + BuildHasher, fn default() -> LinkedHashMap<K, V, S>
fn default() -> LinkedHashMap<K, V, S>Returns the "default value" for a type. Read more
impl<A, B, S> Debug for LinkedHashMap<A, B, S> where
A: Eq + Hash + Debug,
B: Debug,
S: BuildHasher,
impl<A, B, S> Debug for LinkedHashMap<A, B, S> where
A: Eq + Hash + Debug,
B: Debug,
S: BuildHasher, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Returns a string that lists the key-value pairs in insertion order.
impl<K, V, S> Ord for LinkedHashMap<K, V, S> where
K: Eq + Ord + Hash,
S: BuildHasher,
V: Ord,
impl<K, V, S> Ord for LinkedHashMap<K, V, S> where
K: Eq + Ord + Hash,
S: BuildHasher,
V: Ord, fn cmp(&self, other: &LinkedHashMap<K, V, S>) -> Ordering
fn cmp(&self, other: &LinkedHashMap<K, V, S>) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl<'a, K, V, S> IntoIterator for &'a LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
impl<'a, K, V, S> IntoIterator for &'a LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, 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?
ⓘImportant traits for Iter<'a, K, V>fn into_iter(self) -> Iter<'a, K, V>
fn into_iter(self) -> Iter<'a, K, V>Creates an iterator from a value. Read more
impl<'a, K, V, S> IntoIterator for &'a mut LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
impl<'a, K, V, S> IntoIterator for &'a mut LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, 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?
ⓘImportant traits for IterMut<'a, K, V>fn into_iter(self) -> IterMut<'a, K, V>
fn into_iter(self) -> IterMut<'a, K, V>Creates an iterator from a value. Read more
impl<K, V, S> IntoIterator for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
impl<K, V, S> IntoIterator for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, 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?
ⓘImportant traits for IntoIter<K, V>fn into_iter(self) -> IntoIter<K, V>
fn into_iter(self) -> IntoIter<K, V>Creates an iterator from a value. Read more
impl<K, V, S> Sync for LinkedHashMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Sync for LinkedHashMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync, impl<K, V, S> Eq for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: Eq,
impl<K, V, S> Eq for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: Eq, impl<K, V, S> Drop for LinkedHashMap<K, V, S>
impl<K, V, S> Drop for LinkedHashMap<K, V, S>impl<K, V, S> PartialEq<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: PartialEq<V>,
impl<K, V, S> PartialEq<LinkedHashMap<K, V, S>> for LinkedHashMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
V: PartialEq<V>, fn eq(&self, other: &LinkedHashMap<K, V, S>) -> bool
fn eq(&self, other: &LinkedHashMap<K, V, S>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl From<LinkedHashMap<String, Value, RandomState>> for Context
impl From<LinkedHashMap<String, Value, RandomState>> for Contextfn from(data: LinkedHashMap<String, Value, RandomState>) -> Context
fn from(data: LinkedHashMap<String, Value, RandomState>) -> ContextPerforms the conversion.