Struct calx_ecs::ComponentData
[−]
[src]
pub struct ComponentData<C> { /* fields omitted */ }
Storage for a single component type.
Methods
impl<C> ComponentData<C>
[src]
fn new() -> ComponentData<C>
Construct new empty ComponentData
instance.
fn insert(&mut self, e: Entity, comp: C)
Insert a component to an entity.
fn contains(&self, e: Entity) -> bool
Return whether an entity contains this component.
fn get(&self, e: Entity) -> Option<&C>
Get a reference to a component only if it exists for this entity.
fn get_mut(&mut self, e: Entity) -> Option<&mut C>
Get a mutable reference to a component only if it exists for this entity.
fn iter(&self) -> Iter<Entity, C>
Iterate entity-component pairs for this component.
fn iter_mut(&mut self) -> IterMut<Entity, C>
Iterate mutable entity-component pairs for this component.
Trait Implementations
impl<C> Index<Entity> for ComponentData<C>
[src]
type Output = C
The returned type after indexing
fn index<'a>(&'a self, e: Entity) -> &'a C
The method for the indexing (container[index]
) operation
impl<C> IndexMut<Entity> for ComponentData<C>
[src]
fn index_mut<'a>(&'a mut self, e: Entity) -> &'a mut C
The method for the mutable indexing (container[index]
) operation