Enum eclectic::map::Entry [] [src]

pub enum Entry<'a, K: 'a, V: 'a> {
    Occupied(Box<OccupiedEntry<Key=K, Value=V, MutValue=&'a mut V> + 'a>),
    Vacant(Box<VacantEntry<Key=K, Value=V, MutValue=&'a mut V> + 'a>),
}

A map entry.

Variants

Occupied(Box<OccupiedEntry<Key=K, Value=V, MutValue=&'a mut V> + 'a>)

An occupied map entry.

Vacant(Box<VacantEntry<Key=K, Value=V, MutValue=&'a mut V> + 'a>)

A vacant map entry.

Methods

impl<'a, K: 'a, V: 'a> Entry<'a, K, V>
[src]

fn or_insert(self, default: V) -> &'a mut V

Ensures that the entry is occupied by inserting it into the map with the given value if it is vacant.

Returns a mutable reference to the value with the same lifetime as the map.

fn or_insert_with<F: FnOnce() -> V>(self, f: F) -> &'a mut V

Ensures that the entry is occupied by inserting it into the map with the result of the given function if it is vacant.

Returns a mutable reference to the value with the same lifetime as the map.