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 ent_iter(&self) -> Iter<Entity>
Iterate entity ids in this component.
fn iter(&self) -> Iter<C>
Iterate elements in this component.
fn iter_mut(&mut self) -> IterMut<C>
Iterate mutable elements in this component.
Trait Implementations
impl<C> Index<Entity> for ComponentData<C>
[src]
type Output = C
The returned type after indexing
fn index(&self, e: Entity) -> &C
The method for the indexing (container[index]
) operation
impl<C> IndexMut<Entity> for ComponentData<C>
[src]
fn index_mut(&mut self, e: Entity) -> &mut C
The method for the mutable indexing (container[index]
) operation
impl<C> AnyComponent for ComponentData<C>
[src]
impl<C: Serialize + Clone> Serialize for ComponentData<C>
[src]
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl<'a, C: Deserialize<'a>> Deserialize<'a> for ComponentData<C>
[src]
fn deserialize<D: Deserializer<'a>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more