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

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.

Implementations

Returns the number of entries in the map.

See also HashMap::len.

Returns true if the map is empty. Otherwise returns false.

See also HashMap::is_empty.

An iterator visiting all key-value pairs in arbitrary order.

The iterator element type is (&'g K, &'g V).

See also HashMap::iter.

An iterator visiting all keys in arbitrary order.

The iterator element type is &'g K.

See also HashMap::keys.

An iterator visiting all values in arbitrary order.

The iterator element type is &'g V.

See also HashMap::values.

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.

Returns true if the map contains a value for the specified key.

See also HashMap::contains_key.

Returns a reference to the value corresponding to the key.

See also HashMap::get.

Returns the key-value pair corresponding to key.

See also HashMap::get_key_value.

Clears the map, removing all key-value pairs.

See also HashMap::clear.

Inserts a key-value pair into the map.

See also HashMap::insert.

Inserts a key-value pair into the map unless the key already exists.

See also HashMap::try_insert.

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.

Removes a key-value pair from the map, and returns the removed value (if any).

See also HashMap::remove.

source

pub fn remove_entry<'g, Q>(&'g self, key: &Q) -> Option<(&'g K, &'g V)> where
    K: Borrow<Q>,
    Q: ?Sized + 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.

Retains only the elements specified by the predicate.

See also HashMap::retain.

Retains only the elements specified by the predicate.

See also HashMap::retain_force.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.