[][src]Struct orbtk::ComponentStore

pub struct ComponentStore { /* fields omitted */ }

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

Methods

impl TypeComponentStore[src]

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

Register a component for the given entity.

pub fn register_shared<C>(&mut self, target: Entity, source: Entity) where
    C: Component
[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>(&self, entity: Entity) -> bool where
    C: Component
[src]

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

pub fn get<C>(&self, entity: Entity) -> Result<&C, NotFound> where
    C: Component
[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>(&mut self, entity: Entity) -> Result<&mut C, NotFound> where
    C: Component
[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 Default for TypeComponentStore[src]

impl ComponentStore for TypeComponentStore[src]

type Components = (HashMap<TypeId, Box<dyn Any + 'static>, RandomState>, HashMap<TypeId, Entity, RandomState>)

impl Debug for TypeComponentStore[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

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

impl<T> SetParameter for T