[−]Trait acute_ecs::prelude::EntityStore
A queryable collection of entities.
Required methods
fn has_component<T>(&self, entity: Entity) -> bool where
T: Component,
T: Component,
Checks that the provided Component
is present on a given entity.
Returns true if it exists, otherwise false.
fn has_component_by_id(
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
Checks that the provided ComponentTypeId
is present on a given entity.
Returns true if it exists, otherwise false.
fn get_component<T>(&self, entity: Entity) -> Option<Ref<'_, T>> where
T: Component,
T: Component,
Borrows component data for the given entity.
Returns Some(data)
if the entity was found and contains the specified data.
Otherwise None
is returned.
Panics
This function may panic if the component was not declared as read by this system.
unsafe fn get_component_mut_unchecked<T>(
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
Borrows component data for the given entity. Does not perform static borrow checking.
Returns Some(data)
if the entity was found and contains the specified data.
Otherwise None
is returned.
Safety
Accessing a component which is already being concurrently accessed elsewhere is undefined behavior.
Panics
This function may panic if any other code is currently borrowing T
mutable or if the component was not declared
as written by this system.
fn get_tag<T>(&self, entity: Entity) -> Option<&T> where
T: Tag,
T: Tag,
Gets tag data for the given entity.
Returns Some(data)
if the entity was found and contains the specified data.
Otherwise None
is returned.
fn is_alive(&self, entity: Entity) -> bool
Determines if the given Entity
is alive within this World
.
fn get_component_storage<V>(
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'a> View<'a>,
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'a> View<'a>,
Gets the entity component storage. Validates that the world can provide access to everything needed by the view.
Provided methods
fn get_component_mut<T>(&mut self, entity: Entity) -> Option<RefMut<'_, T>> where
T: Component,
T: Component,
Mutably borrows entity data for the given entity.
Returns Some(data)
if the entity was found and contains the specified data.
Otherwise None
is returned.
Panics
This function may panic if the component was not declared as written by this system.
Implementors
impl EntityStore for World
fn has_component<T>(&self, entity: Entity) -> bool where
T: Component,
T: Component,
fn has_component_by_id(
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
fn get_component<T>(&self, entity: Entity) -> Option<Ref<'_, T>> where
T: Component,
T: Component,
unsafe fn get_component_mut_unchecked<T>(
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
fn get_tag<T>(&self, entity: Entity) -> Option<&T> where
T: Tag,
T: Tag,
fn is_alive(&self, entity: Entity) -> bool
fn get_component_storage<V>(
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'b> View<'b>,
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'b> View<'b>,
impl<'a> EntityStore for SubWorld<'a>
fn has_component<T>(&self, entity: Entity) -> bool where
T: Component,
T: Component,
fn has_component_by_id(
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
&self,
entity: Entity,
component: ComponentTypeId
) -> bool
fn get_component<T>(&self, entity: Entity) -> Option<Ref<'_, T>> where
T: Component,
T: Component,
unsafe fn get_component_mut_unchecked<T>(
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
&self,
entity: Entity
) -> Option<RefMut<'_, T>> where
T: Component,
fn get_tag<T>(&self, entity: Entity) -> Option<&T> where
T: Tag,
T: Tag,
fn is_alive(&self, entity: Entity) -> bool
fn get_component_storage<V>(
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'b> View<'b>,
&self
) -> Result<StorageAccessor<'_>, ComponentAccessError> where
V: for<'b> View<'b>,