[][src]Struct flurry::HashMapRef

pub struct HashMapRef<'map, K, V, S = DefaultHashBuilder> { /* fields omitted */ }

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]

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]

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Ord
[src]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

impl<'_, K, V, S> Debug for HashMapRef<'_, K, V, S> where
    K: Debug,
    V: Debug
[src]

impl<'_, K, V, S> Eq for HashMapRef<'_, K, V, S> where
    K: Hash + Ord,
    V: Eq,
    S: BuildHasher
[src]

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]

type Output = V

The returned type after indexing.

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.

impl<'_, K, V, S> PartialEq<HashMap<K, V, S>> for HashMapRef<'_, K, V, S> where
    K: Hash + Ord,
    V: PartialEq,
    S: BuildHasher
[src]

impl<'_, K, V, S> PartialEq<HashMapRef<'_, K, V, S>> for HashMapRef<'_, K, V, S> where
    K: Hash + Ord,
    V: PartialEq,
    S: BuildHasher
[src]

impl<'_, K, V, S> PartialEq<HashMapRef<'_, K, V, S>> for HashMap<K, V, S> where
    K: Hash + Ord,
    V: PartialEq,
    S: BuildHasher
[src]

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]

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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.