pub enum Entry<'a, K, V: Serial, S: HasStateApi> {
    Vacant(VacantEntry<'a, K, V, S>),
    Occupied(OccupiedEntry<'a, K, V, S>),
}
Expand description

A view into a single entry in a StateMap, which may either be vacant or occupied.

This enum is constructed from the entry method on a StateMap type.

Variants

Vacant(VacantEntry<'a, K, V, S>)

Occupied(OccupiedEntry<'a, K, V, S>)

Implementations

Return whether the entry is vacant.

Return whether the entry is occupied.

If the entry is Occupied return Ok. Otherwise return the supplied error.

If the entry is Vacant return Ok. Otherwise return the supplied error.

Ensure a value is in the entry by inserting the provided value if the entry is vacant.

Ensures a value is in the entry by inserting the result of the default function if empty.

If the entry is occupied apply the given function to its contents. If the function returns an error the contents are not updated. If the supplied function returns an error then it should not modify the given value. If it does so than the map will become inconsistent. If the entry is vacant no changes are made.

If the entry is occupied apply the given function to its contents. If the entry is vacant no changes are made.

Return a reference to this entry’s key.

Ensures a value is in the entry by inserting the default value if empty.

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 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.