Enum specs::StorageEntry
[−]
[src]
pub enum StorageEntry<'a, 'b: 'a, T: 'a, D: 'a> { Occupied(OccupiedEntry<'a, 'b, T, D>), Vacant(VacantEntry<'a, 'b, T, D>), }
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 does has a component.
Vacant(VacantEntry<'a, 'b, T, D>)
Entry variant that is returned if the entity does not have a component.
Methods
impl<'a, 'b, T, D> StorageEntry<'a, 'b, T, D> where
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
[src]
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
pub fn or_insert(self, component: T) -> &'a mut T
[src]
Inserts a component if the entity does not contain a component.
pub fn or_insert_with<F>(self, default: F) -> &'a mut T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
Inserts a component using a lazily called function that is only called when inserting the component.