Method lrs::hashmap::Entry::or_insert

Returns the occupied entry or inserts a new key.

Syntax

impl<'a, Key, Value, Bucket> Entry<'a, Key, Value, Bucket>
    where Bucket: Bucket<Key, Value> + 'a,
          Key: Eq<Key> + Hash,
{
    fn or_insert(self, key: Key, value: Value) -> OccupiedEntry<'a, Key, Value, Bucket>
}

Arguments

NameDescription
key

The key that will be inserted.

This key should hash to the same value as the key that was used to retrieve this entry. Otherwise it might not be possible to retrieve the stored value until the table is resized.

value

The value that will be inserted.