pub enum StorageEntry<'a, 'b: 'a, T: 'a, D: 'a> {
    Occupied(OccupiedEntry<'a, 'b, T, D>),
    Vacant(VacantEntry<'a, 'b, T, D>),
}
Expand description

Entry to a storage for convenient filling of components or removal based on whether the entity has a component.

Variants

Occupied(OccupiedEntry<'a, 'b, T, D>)

Entry variant that is returned if the entity has a component.

Vacant(VacantEntry<'a, 'b, T, D>)

Entry variant that is returned if the entity does not have a component.

Implementations

Inserts a component and returns the old value in case this entry was already occupied.

Inserts a component if the entity does not have it already.

Inserts a component using a lazily called function that is only called when inserting the component. Ensures this entry has a value and if not, inserts one using the result of the passed closure. Returns a reference to the value afterwards.

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.