[−][src]Struct flurry::HashMapRef
A reference to a HashMap
, constructed with HashMap::pin
or HashMap::with_guard
.
The current thread will be pinned for the duration of this reference. Keep in mind that this prevents the collection of garbage generated by the map.
Methods
impl<'_, K, V, S> HashMapRef<'_, K, V, S>
[src]
pub fn len(&self) -> usize
[src]
Returns the number of entries in the map.
See also HashMap::len
.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the map is empty. Otherwise returns false
.
See also HashMap::is_empty
.
pub fn iter(&self) -> Iter<K, V>
[src]
An iterator visiting all key-value pairs in arbitrary order.
The iterator element type is (&'g K, &'g V)
.
See also HashMap::iter
.
pub fn keys(&self) -> Keys<K, V>
[src]
An iterator visiting all keys in arbitrary order.
The iterator element type is &'g K
.
See also HashMap::keys
.
pub fn values(&self) -> Values<K, V>
[src]
An iterator visiting all values in arbitrary order.
The iterator element type is &'g V
.
See also HashMap::values
.
impl<'_, K, V, S> HashMapRef<'_, K, V, S> where
K: Clone + Ord,
[src]
K: Clone + Ord,
pub fn reserve(&self, additional: usize)
[src]
Tries to reserve capacity for at least additional
more elements to be inserted in the
HashMap
.
The collection may reserve more space to avoid frequent reallocations.
See also HashMap::reserve
.
impl<'_, K, V, S> HashMapRef<'_, K, V, S> where
K: Hash + Ord,
S: BuildHasher,
[src]
K: Hash + Ord,
S: BuildHasher,
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Ord,
[src]
K: Borrow<Q>,
Q: Hash + Ord,
Returns true
if the map contains a value for the specified key.
See also HashMap::contains_key
.
pub fn get<'g, Q: ?Sized>(&'g self, key: &Q) -> Option<&'g V> where
K: Borrow<Q>,
Q: Hash + Ord,
[src]
K: Borrow<Q>,
Q: Hash + Ord,
Returns a reference to the value corresponding to the key.
See also HashMap::get
.
pub fn get_key_value<'g, Q: ?Sized>(&'g self, key: &Q) -> Option<(&'g K, &'g V)> where
K: Borrow<Q>,
Q: Hash + Ord,
[src]
K: Borrow<Q>,
Q: Hash + Ord,
Returns the key-value pair corresponding to key
.
See also HashMap::get_key_value
.
impl<'_, K, V, S> HashMapRef<'_, K, V, S> where
K: Clone + Ord,
[src]
K: Clone + Ord,
pub fn clear(&self)
[src]
Clears the map, removing all key-value pairs.
See also HashMap::clear
.
impl<'_, K, V, S> HashMapRef<'_, K, V, S> where
K: 'static + Sync + Send + Clone + Hash + Ord,
V: 'static + Sync + Send,
S: BuildHasher,
[src]
K: 'static + Sync + Send + Clone + Hash + Ord,
V: 'static + Sync + Send,
S: BuildHasher,
pub fn insert(&self, key: K, value: V) -> Option<&V>
[src]
Inserts a key-value pair into the map.
See also HashMap::insert
.
pub fn try_insert(&self, key: K, value: V) -> Result<&V, TryInsertError<V>>
[src]
Inserts a key-value pair into the map unless the key already exists.
See also HashMap::try_insert
.
pub fn compute_if_present<'g, Q: ?Sized, F>(
&'g self,
key: &Q,
remapping_function: F
) -> Option<&'g V> where
K: Borrow<Q>,
Q: Hash + Ord,
F: FnOnce(&K, &V) -> Option<V>,
[src]
&'g self,
key: &Q,
remapping_function: F
) -> Option<&'g V> where
K: Borrow<Q>,
Q: Hash + Ord,
F: FnOnce(&K, &V) -> Option<V>,
If the value for the specified key
is present, attempts to
compute a new mapping given the key and its current mapped value.
See also HashMap::compute_if_present
.
pub fn remove<'g, Q: ?Sized>(&'g self, key: &Q) -> Option<&'g V> where
K: Borrow<Q>,
Q: Hash + Ord,
[src]
K: Borrow<Q>,
Q: Hash + Ord,
Removes a key-value pair from the map, and returns the removed value (if any).
See also HashMap::remove
.
pub fn remove_entry<'g, Q: ?Sized>(&'g self, key: &Q) -> Option<(&'g K, &'g V)> where
K: Borrow<Q>,
Q: Hash + Ord,
[src]
K: Borrow<Q>,
Q: Hash + Ord,
Removes a key from the map, returning the stored key and value if the key was previously in the map.
See also HashMap::remove_entry
.
pub fn retain<F>(&self, f: F) where
F: FnMut(&K, &V) -> bool,
[src]
F: FnMut(&K, &V) -> bool,
Retains only the elements specified by the predicate.
See also HashMap::retain
.
pub fn retain_force<F>(&self, f: F) where
F: FnMut(&K, &V) -> bool,
[src]
F: FnMut(&K, &V) -> bool,
Retains only the elements specified by the predicate.
See also HashMap::retain_force
.
Trait Implementations
impl<'_, K, V, S> Clone for HashMapRef<'_, K, V, S>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'_, K, V, S> Debug for HashMapRef<'_, K, V, S> where
K: Debug,
V: Debug,
[src]
K: Debug,
V: Debug,
impl<'_, K, V, S> Eq for HashMapRef<'_, K, V, S> where
K: Hash + Ord,
V: Eq,
S: BuildHasher,
[src]
K: Hash + Ord,
V: Eq,
S: BuildHasher,
impl<'_, '_, K, Q: ?Sized, V, S> Index<&'_ Q> for HashMapRef<'_, K, V, S> where
K: Hash + Ord + Borrow<Q>,
Q: Hash + Ord,
S: BuildHasher,
[src]
K: Hash + Ord + Borrow<Q>,
Q: Hash + Ord,
S: BuildHasher,
impl<'g, '_, K, V, S> IntoIterator for &'g HashMapRef<'_, K, V, S>
[src]
type IntoIter = Iter<'g, K, V>
Which kind of iterator are we turning this into?
type Item = (&'g K, &'g V)
The type of the elements being iterated over.
fn into_iter(self) -> Self::IntoIter
[src]
impl<'_, K, V, S> PartialEq<HashMap<K, V, S>> for HashMapRef<'_, K, V, S> where
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
[src]
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
fn eq(&self, other: &HashMap<K, V, S>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, K, V, S> PartialEq<HashMapRef<'_, K, V, S>> for HashMapRef<'_, K, V, S> where
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
[src]
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
impl<'_, K, V, S> PartialEq<HashMapRef<'_, K, V, S>> for HashMap<K, V, S> where
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
[src]
K: Hash + Ord,
V: PartialEq,
S: BuildHasher,
Auto Trait Implementations
impl<'map, K, V, S = RandomState> !RefUnwindSafe for HashMapRef<'map, K, V, S>
impl<'map, K, V, S = RandomState> !Send for HashMapRef<'map, K, V, S>
impl<'map, K, V, S = RandomState> !Sync for HashMapRef<'map, K, V, S>
impl<'map, K, V, S> Unpin for HashMapRef<'map, K, V, S>
impl<'map, K, V, S = RandomState> !UnwindSafe for HashMapRef<'map, K, V, S>
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,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
fn to_owned(&self) -> T
[src]
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.
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>,