pub trait VacantEntry<'c>: Sized {
    type Value: 'c;
    type Occupied: OccupiedEntry<'c>;
    fn occupy(self, val: Self::Value) -> Self::Occupied;

    fn insert(self, val: Self::Value) { ... }
}
Expand description

A vacant entry of a collection.

This is a slot into which you can insert a value with no concern for there already being a value there, because if you have a vacant entry, you have already done the work to confirm the slot is open and ready for a value.

The idea is that you’ve done hard work of finding your place in the collection, so inserting shouldn’t be a huge penalty at this point.

Associated Types

The type of values in the collection.

The type of OccupiedEntry we convert to when inserting.

Required methods

insert the val using the owned key, returning the occupied entry

Provided methods

insert the val using the owned key.

if you need to chain a future deletion, use insert_entry

Implementors