Struct entity_data::EntityStorage
source · [−]pub struct EntityStorage { /* private fields */ }Expand description
A container of entities.
Implementations
sourceimpl EntityStorage
impl EntityStorage
sourcepub fn new() -> EntityStorage
pub fn new() -> EntityStorage
Creates an empty EntityStorage.
sourcepub fn add_entity<S>(&mut self, state: S) -> EntityIdwhere
S: ArchetypeState,
pub fn add_entity<S>(&mut self, state: S) -> EntityIdwhere
S: ArchetypeState,
Creates a new entity and returns its identifier.
sourcepub fn get_archetype<A: StaticArchetype>(&self) -> Option<&Archetype>
pub fn get_archetype<A: StaticArchetype>(&self) -> Option<&Archetype>
Returns a reference to the specified archetype.
sourcepub fn get_archetype_mut<A: StaticArchetype>(
&mut self
) -> Option<&mut Archetype>
pub fn get_archetype_mut<A: StaticArchetype>(
&mut self
) -> Option<&mut Archetype>
Returns a mutable reference to the specified archetype.
sourcepub fn get<C: Component>(&self, entity: &EntityId) -> Option<&C>
pub fn get<C: Component>(&self, entity: &EntityId) -> Option<&C>
Returns a reference to the component C of the specified entity.
sourcepub fn get_mut<C: Component>(&mut self, entity: &EntityId) -> Option<&mut C>
pub fn get_mut<C: Component>(&mut self, entity: &EntityId) -> Option<&mut C>
Returns a mutable reference to the component C of the specified entity.
sourcepub fn remove(&mut self, entity: &EntityId) -> bool
pub fn remove(&mut self, entity: &EntityId) -> bool
Removes an entity from the storage. Returns true if the entity was present in the storage.
sourcepub fn n_archetypes(&mut self) -> usize
pub fn n_archetypes(&mut self) -> usize
Returns the number of entities in the storage.
sourcepub fn count_entities(&mut self) -> usize
pub fn count_entities(&mut self) -> usize
Returns the number of entities in the storage.
Auto Trait Implementations
impl RefUnwindSafe for EntityStorage
impl Send for EntityStorage
impl Sync for EntityStorage
impl Unpin for EntityStorage
impl UnwindSafe for EntityStorage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more