Enum typemap::Entry [] [src]

pub enum Entry<'a, K, A: ?Sized + UnsafeAnyExt + 'a = UnsafeAny> {
    Occupied(OccupiedEntry<'a, K, A>),
    Vacant(VacantEntry<'a, K, A>),
}

A view onto an entry in a TypeMap.

Variants

Occupied

A view onto an occupied entry in a TypeMap.

Vacant

A view onto an unoccupied entry in a TypeMap.

Methods

impl<'a, K: Key, A: ?Sized + UnsafeAnyExt + 'a = UnsafeAny> Entry<'a, K, A>

fn or_insert(self, default: K::Value) -> &'a mut K::Value where K::Value: Any + Implements<A>

Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.

fn or_insert_with<F: FnOnce() -> K::Value>(self, default: F) -> &'a mut K::Value where K::Value: Any + Implements<A>

Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.