[][src]Struct dces::component::TypeComponentStore

pub struct TypeComponentStore { /* fields omitted */ }

The TypeComponentStore stores the components of all entities. It could be used to borrow the components of the entities.

Implementations

impl TypeComponentStore[src]

pub fn register<C: Component>(&mut self, entity: Entity, component: C)[src]

Register a component for the given entity.

pub fn register_shared<C: Component>(&mut self, target: Entity, source: Entity)[src]

Registers a sharing of the given component between the given entities.

pub fn register_shared_box(
    &mut self,
    target: impl Into<Entity>,
    source: SharedComponentBox
)
[src]

Registers a sharing of the given component between the given entities.

pub fn register_box(
    &mut self,
    entity: impl Into<Entity>,
    component_box: ComponentBox
)
[src]

Register a component_box for the given entity.

pub fn len(&self) -> usize[src]

Returns the number of components in the store.

pub fn is_empty(&self) -> bool[src]

Returns true if the components are empty.

pub fn contains_entity(&self, entity: Entity) -> bool[src]

Returns true if the store contains the specific entity.

pub fn is_origin<C: Component>(&self, entity: Entity) -> bool[src]

Returns true if entity is the origin of the requested component false.

pub fn get<C: Component>(&self, entity: Entity) -> Result<&C, NotFound>[src]

Returns a reference of a component of type C from the given entity. If the entity does not exists or it doesn't have a component of type C NotFound will be returned.

pub fn get_mut<C: Component>(
    &mut self,
    entity: Entity
) -> Result<&mut C, NotFound>
[src]

Returns a mutable reference of a component of type C from the given entity. If the entity does not exists or it doesn't have a component of type C NotFound will be returned.

Trait Implementations

impl ComponentStore for TypeComponentStore[src]

type Components = (HashMap<TypeId, Box<dyn Any>>, HashMap<TypeId, Entity>)

impl Debug for TypeComponentStore[src]

impl Default for TypeComponentStore[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<E> Component for E where
    E: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.