Struct entity_data::EntityStorage
source · [−]pub struct EntityStorage { /* private fields */ }Expand description
A container of entities.
Implementations
sourceimpl EntityStorage
impl EntityStorage
sourcepub fn new(layout: &EntityStorageLayout) -> EntityStorage
pub fn new(layout: &EntityStorageLayout) -> EntityStorage
Creates an empty EntityStorage.
sourcepub fn add_entity<const N: usize, const D: usize>(
&mut self,
archetype_id: u32,
state: EntityState<N, D>
) -> EntityId
pub fn add_entity<const N: usize, const D: usize>(
&mut self,
archetype_id: u32,
state: EntityState<N, D>
) -> EntityId
Builds a new entity and returns its identifier.
Panics
- if specified archetype is not found;
- if specified component types != archetype component types;
sourcepub fn get_archetype(&self, id: u32) -> Option<&Archetype>
pub fn get_archetype(&self, id: u32) -> Option<&Archetype>
Returns a reference to the specified archetype.
sourcepub fn get_archetype_mut(&mut self, id: u32) -> Option<&mut Archetype>
pub fn get_archetype_mut(&mut self, id: u32) -> Option<&mut Archetype>
Returns a mutable reference to the specified archetype.
sourcepub fn get<C: 'static>(&self, entity: &EntityId) -> Option<&C>
pub fn get<C: 'static>(&self, entity: &EntityId) -> Option<&C>
Returns a reference to the component C of the specified entity.
sourcepub fn get_mut<C: 'static>(&mut self, entity: &EntityId) -> Option<&mut C>
pub fn get_mut<C: 'static>(&mut self, entity: &EntityId) -> Option<&mut C>
Returns a mutable reference to the component C of the specified entity.
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