[−][src]Struct orbtk::prelude::ComponentStore
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]
C: Component,
Register a component
for the given entity
.
pub fn register_shared<C>(&mut self, target: Entity, source: Entity) where
C: Component,
[src]
C: Component,
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]
&mut self,
target: impl Into<Entity>,
source: SharedComponentBox
)
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]
&mut self,
entity: impl Into<Entity>,
component_box: ComponentBox
)
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]
C: Component,
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]
C: Component,
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]
C: Component,
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]
fn default() -> TypeComponentStore
[src]
impl ComponentStore for TypeComponentStore
[src]
type Components = (HashMap<TypeId, Box<dyn Any + 'static>, RandomState>, HashMap<TypeId, Entity, RandomState>)
fn append(
&mut self,
entity: Entity,
components: <TypeComponentStore as ComponentStore>::Components
)
[src]
&mut self,
entity: Entity,
components: <TypeComponentStore as ComponentStore>::Components
)
fn remove_entity(&mut self, entity: impl Into<Entity>)
[src]
fn print_entity(&self, entity: impl Into<Entity>)
[src]
impl Debug for TypeComponentStore
[src]
Auto Trait Implementations
impl !Send for TypeComponentStore
impl !Sync for TypeComponentStore
impl Unpin for TypeComponentStore
impl !UnwindSafe for TypeComponentStore
impl !RefUnwindSafe for TypeComponentStore
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<E> Component for E where
E: Any,
[src]
E: Any,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,