pub struct HashMap<K, V, S = RandomState> { /* private fields */ }Expand description
A wrapper type around [hashbrown::hash_map::HashMap] that only exposes
fallible allocation.
Implementations§
Source§impl<K, V> HashMap<K, V, RandomState>
impl<K, V> HashMap<K, V, RandomState>
Source§impl<K, V> HashMap<K, V, RandomState>
impl<K, V> HashMap<K, V, RandomState>
Sourcepub fn with_capacity(capacity: usize) -> Result<Self, OutOfMemory>
pub fn with_capacity(capacity: usize) -> Result<Self, OutOfMemory>
Same as [hashbrown::hash_map::HashMap::with_capacity] but returns an
error on allocation failure.
Source§impl<K, V, S> HashMap<K, V, S>
impl<K, V, S> HashMap<K, V, S>
Sourcepub const fn with_hasher(hasher: S) -> Self
pub const fn with_hasher(hasher: S) -> Self
Same as [hashbrown::hash_map::HashMap::with_hasher].
Sourcepub fn extract_if<F>(&mut self, f: F) -> ExtractIf<'_, K, V, F> ⓘ
pub fn extract_if<F>(&mut self, f: F) -> ExtractIf<'_, K, V, F> ⓘ
Same as [hashbrown::hash_map::HashMap::extract_if].
Source§impl<K, V, S> HashMap<K, V, S>
impl<K, V, S> HashMap<K, V, S>
Sourcepub fn with_capacity_and_hasher(
capacity: usize,
hasher: S,
) -> Result<Self, OutOfMemory>
pub fn with_capacity_and_hasher( capacity: usize, hasher: S, ) -> Result<Self, OutOfMemory>
Same as [hashbrown::hash_map::HashMap::with_capacity_and_hasher] but
returns an error on allocation failure.
Sourcepub fn reserve(&mut self, additional: usize) -> Result<(), OutOfMemory>
pub fn reserve(&mut self, additional: usize) -> Result<(), OutOfMemory>
Same as [hashbrown::hash_map::HashMap::reserve] but returns an error
on allocation failure.
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Same as [hashbrown::hash_map::HashMap::contains_key].
Sourcepub fn insert(&mut self, key: K, value: V) -> Result<Option<V>, OutOfMemory>
pub fn insert(&mut self, key: K, value: V) -> Result<Option<V>, OutOfMemory>
Same as [hashbrown::hash_map::HashMap::insert] but returns an error on
allocation failure.
Trait Implementations§
Source§impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
Source§impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
Source§impl<K, V, S> IntoIterator for HashMap<K, V, S>
impl<K, V, S> IntoIterator for HashMap<K, V, S>
Source§impl<K, V, S> TryClone for HashMap<K, V, S>
impl<K, V, S> TryClone for HashMap<K, V, S>
Source§fn try_clone(&self) -> Result<Self, OutOfMemory>
fn try_clone(&self) -> Result<Self, OutOfMemory>
Attempt to clone
self, returning an error if any allocation fails
during cloning.impl<K, V, S> Eq for HashMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> Freeze for HashMap<K, V, S>where
S: Freeze,
impl<K, V, S> RefUnwindSafe for HashMap<K, V, S>
impl<K, V, S> Send for HashMap<K, V, S>
impl<K, V, S> Sync for HashMap<K, V, S>
impl<K, V, S> Unpin for HashMap<K, V, S>
impl<K, V, S> UnwindSafe for HashMap<K, V, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more