Method lrs::hashmap::Entry::or_insert_with

Returns the occupied entry or inserts the result of a function.

Syntax

impl<'a, Key, Value, Bucket> Entry<'a, Key, Value, Bucket>
    where Bucket: Bucket<Key, Value> + 'a,
          Key: Eq<Key> + Hash,
{
    fn or_insert_with<F>(self, f: F) -> OccupiedEntry<'a, Key, Value, Bucket>
        where F: FnOnce() -> (Key, Value),
}

Arguments

NameDescription
f

The function that will be called if the bucket is empty.