Enum amethyst::ecs::storage::StorageEntry [−]
pub enum StorageEntry<'a, 'b, T, D> where
'b: 'a,
D: 'a,
T: '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
D: DerefMut<Target = MaskedStorage<T>>,
T: Component,
impl<'a, 'b, T, D> StorageEntry<'a, 'b, T, D> where
D: DerefMut<Target = MaskedStorage<T>>,
T: Component, ⓘImportant traits for &'a mut Rpub fn or_insert(self, component: T) -> &'a mut T
ⓘImportant traits for &'a mut R
pub fn or_insert(self, component: T) -> &'a mut TInserts a component if the entity does not contain a component.
ⓘImportant traits for &'a mut Rpub fn or_insert_with<F>(self, default: F) -> &'a mut T where
F: FnOnce() -> T,
ⓘImportant traits for &'a mut R
pub fn or_insert_with<F>(self, default: F) -> &'a mut T where
F: FnOnce() -> T, Inserts a component using a lazily called function that is only called when inserting the component.
Auto Trait Implementations
impl<'a, 'b, T, D> Send for StorageEntry<'a, 'b, T, D> where
D: Send,
T: Send,
impl<'a, 'b, T, D> Send for StorageEntry<'a, 'b, T, D> where
D: Send,
T: Send, impl<'a, 'b, T, D> Sync for StorageEntry<'a, 'b, T, D> where
D: Sync,
T: Sync,
impl<'a, 'b, T, D> Sync for StorageEntry<'a, 'b, T, D> where
D: Sync,
T: Sync,