Struct shard_ecs::Registry [−][src]
pub struct Registry { /* fields omitted */ }
Expand description
The main Registry of the ECS. Essentially an instance of the ECS. Systems in this ECS implementation are implicit, meaning anything can be a system as decided by the user.
Implementations
Internal function which scatters the pools of each archetype collection.
pub fn add_entity<'c, C: ComponentGroup<'c>>(
&mut self,
components: C
) -> Result<Entity, (C, ECSError)>
pub fn add_entity<'c, C: ComponentGroup<'c>>(
&mut self,
components: C
) -> Result<Entity, (C, ECSError)>
Adds a new entity to the Registry, constructed of the components in the given componentgroup instance.
Erases an existing entity, dropping it’s components. Returns true if succeeded.
Only removes an entity if it exactly matches the components. Otherwise the entity is not removed. Returns the components of the entity if removal was succesfull.
Adds a component instance to the given entity. Fails, returning the component, if allocation fails, already contains the given type, or the entity already has max amount of components. Also fails if given entity handle is invalid.
Removes a component instance from the given entity. Fails if such entity does not exist. Also fails if entity cannot be moved due to allocation failure.
Erases a component instance from the given entity. Fails if such entity does not exist. Essentially the same as remove_component, but drops the component instead of returning it. Also fails if entity cannot be moved due to allocation failure.
pub fn get_component<C: Component>(
&self,
entity: Entity
) -> Option<<C::Allocator as ComponentAllocator<'_, C>>::RefType>
pub fn get_component<C: Component>(
&self,
entity: Entity
) -> Option<<C::Allocator as ComponentAllocator<'_, C>>::RefType>
Returns a reference to a entity’s component of type C, if the entity contains such component.
pub fn get_component_mut<C: Component>(
&mut self,
entity: Entity
) -> Option<<C::Allocator as ComponentAllocator<'_, C>>::MutRefType>
pub fn get_component_mut<C: Component>(
&mut self,
entity: Entity
) -> Option<<C::Allocator as ComponentAllocator<'_, C>>::MutRefType>
Returns a mutable reference to a entity’s component of type C, if the entity contains such component.
pub fn get_components<'r, G: ComponentGroup<'r>>(
&self,
_entity: Entity
) -> Option<G::RefTuple>
pub fn get_components<'r, G: ComponentGroup<'r>>(
&self,
_entity: Entity
) -> Option<G::RefTuple>
Returns a reference to a entity’s components of types G, if the entity contains such components.
pub fn get_components_mut<'r, G: ComponentGroup<'r>>(
&mut self,
_entity: Entity
) -> Option<G::MutRefTuple>
pub fn get_components_mut<'r, G: ComponentGroup<'r>>(
&mut self,
_entity: Entity
) -> Option<G::MutRefTuple>
Returns a reference to a entity’s components of types G, if the entity contains such components.
pub fn iter_components_exact<'r, G: ComponentGroup<'r>>(
&'r self
) -> ComponentIteratorExact<'_, G>ⓘNotable traits for ComponentIteratorExact<'r, G>
impl<'r, G: ComponentGroup<'r>> Iterator for ComponentIteratorExact<'r, G> type Item = G::SliceRefTuple;
pub fn iter_components_exact<'r, G: ComponentGroup<'r>>(
&'r self
) -> ComponentIteratorExact<'_, G>ⓘNotable traits for ComponentIteratorExact<'r, G>
impl<'r, G: ComponentGroup<'r>> Iterator for ComponentIteratorExact<'r, G> type Item = G::SliceRefTuple;
Returns an iterator over all entities containing exactly and only the given component types.
pub fn iter_components_exact_mut<'r, G: ComponentGroup<'r>>(
&'r mut self
) -> ComponentIteratorExactMut<'_, G>ⓘNotable traits for ComponentIteratorExactMut<'r, G>
impl<'r, G: ComponentGroup<'r>> Iterator for ComponentIteratorExactMut<'r, G> type Item = G::SliceMutRefTuple;
pub fn iter_components_exact_mut<'r, G: ComponentGroup<'r>>(
&'r mut self
) -> ComponentIteratorExactMut<'_, G>ⓘNotable traits for ComponentIteratorExactMut<'r, G>
impl<'r, G: ComponentGroup<'r>> Iterator for ComponentIteratorExactMut<'r, G> type Item = G::SliceMutRefTuple;
Returns a mutable iterator over all entities containing exactly and only the given component types.
pub fn iter_components<'r, G: ComponentGroup<'r>>(
&'r self
) -> ComponentIterator<'r, G>ⓘNotable traits for ComponentIterator<'r, C>
impl<'r, C: ComponentGroup<'r>> Iterator for ComponentIterator<'r, C> type Item = ComponentIteratorExact<'r, C>;
pub fn iter_components<'r, G: ComponentGroup<'r>>(
&'r self
) -> ComponentIterator<'r, G>ⓘNotable traits for ComponentIterator<'r, C>
impl<'r, C: ComponentGroup<'r>> Iterator for ComponentIterator<'r, C> type Item = ComponentIteratorExact<'r, C>;
Returns an iterator over all entities containing the given component types.
pub fn iter_components_mut<'r, G: ComponentGroup<'r>>(
&'r mut self
) -> ComponentIterator<'r, G>ⓘNotable traits for ComponentIterator<'r, C>
impl<'r, C: ComponentGroup<'r>> Iterator for ComponentIterator<'r, C> type Item = ComponentIteratorExact<'r, C>;
pub fn iter_components_mut<'r, G: ComponentGroup<'r>>(
&'r mut self
) -> ComponentIterator<'r, G>ⓘNotable traits for ComponentIterator<'r, C>
impl<'r, C: ComponentGroup<'r>> Iterator for ComponentIterator<'r, C> type Item = ComponentIteratorExact<'r, C>;
Returns an iterator over all entities containing the given component types.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Registry
impl UnwindSafe for Registry