[][src]Struct keeshond::scene::ComponentStore

pub struct ComponentStore<C: Component + 'static> { /* fields omitted */ }

Stores all instances of a Component for a given type, indexed based on the Entities they belong to.

Implementations

impl<C: Component + 'static> ComponentStore<C>[src]

pub fn get_entity(&self, entity: &Entity) -> Option<&C>[src]

Returns an immutable reference to the Component for the given Entity, or None if it does not exist.

pub fn get_entity_mut(&mut self, entity: &Entity) -> Option<&mut C>[src]

Returns a mutable reference to the Component for the given Entity, or None if it does not exist.

pub fn clone_from_entity(&self, entity: &Entity) -> Option<C> where
    C: Clone
[src]

pub fn set_entity(&mut self, entity: &Entity, component: C) -> bool[src]

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

Returns the number of Entities with this Component

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

Returns true if there is a Component for the given Entity

pub fn sort<F: FnMut(&C, &C) -> Ordering>(&mut self, compare: F)[src]

pub fn iter(&self) -> ComponentIter<'_, C>

Notable traits for ComponentIter<'a, C>

impl<'a, C: Component + 'static> Iterator for ComponentIter<'a, C> type Item = (Entity, &'a C);
[src]

Returns a ComponentIter that iterates through all Components in the store. Typically used in a DrawerSystem.

pub fn iter_mut(&mut self) -> ComponentIterMut<'_, C>

Notable traits for ComponentIterMut<'a, C>

impl<'a, C: Component + 'static> Iterator for ComponentIterMut<'a, C> type Item = (Entity, &'a mut C);
[src]

Returns a ComponentIterMut that iterates through all Components in the store. Typically used in a ThinkerSystem.

pub fn singleton(&self) -> Option<&C>[src]

pub fn singleton_mut(&mut self) -> &mut C where
    C: Default
[src]

pub fn singleton_mut_or<F: FnMut() -> C>(&mut self, func: F) -> &mut C[src]

Trait Implementations

impl<C: Debug + Component + 'static> Debug for ComponentStore<C>[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for ComponentStore<C> where
    C: RefUnwindSafe

impl<C> Send for ComponentStore<C> where
    C: Send

impl<C> Sync for ComponentStore<C> where
    C: Sync

impl<C> Unpin for ComponentStore<C> where
    C: Unpin

impl<C> UnwindSafe for ComponentStore<C> where
    C: UnwindSafe

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<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> Erased for T

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

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

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

type Output = T

Should always be Self

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.