[][src]Struct specs_static::Storage

pub struct Storage<C, D: UnprotectedStorage<C>, I> { /* fields omitted */ }

A storage for components managed with specs_static::Id instead of Entity. This Storage behaves very similar to specs' Storage.

Registering

These component storages also have to be registered. This can be done using the WorldExt trait and its register_tile_comp method.

Methods

impl<C, D, I> Storage<C, D, I> where
    C: Component,
    D: UnprotectedStorage<C>,
    I: Id
[src]

pub fn get(&self, id: I) -> Option<&C>[src]

Tries to retrieve a component by its Id. This will only check whether a component is inserted or not, without doing any liveness checks for the id.

pub fn get_mut(&mut self, id: I) -> Option<&mut C>[src]

Tries to retrieve a component mutably by its Id. This will only check whether a component is inserted or not, without doing any liveness checks for the id.

pub fn insert(&mut self, id: I, comp: C) -> Option<C>[src]

Inserts comp at id. If there already was a value, it will be returned.

In contrast to entities, there are no invalid ids.

pub fn remove(&mut self, id: I) -> Option<C>[src]

Removes the component at id.

Trait Implementations

impl<C, D, I> Drop for Storage<C, D, I> where
    D: UnprotectedStorage<C>, 
[src]

impl<C, D: UnprotectedStorage<C>, I> Default for Storage<C, D, I> where
    D: Default
[src]

impl<'a, C, D, I> Join for &'a Storage<C, D, I> where
    D: UnprotectedStorage<C>, 
[src]

type Type = &'a C

Type of joined components.

type Value = &'a D

Type of joined storages.

type Mask = &'a BitSet

Type of joined bit mask.

fn join(self) -> JoinIter<Self>[src]

Create a joined iterator over the contents.

fn maybe(self) -> MaybeJoin<Self>[src]

Returns a Join-able structure that yields all indices, returning None for all missing elements and Some(T) for found elements. Read more

fn is_unconstrained() -> bool[src]

If this Join typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter/ParJoin to go through all indices which is usually not what is wanted and will kill performance. Read more

impl<'a, C, D, I> Join for &'a mut Storage<C, D, I> where
    D: UnprotectedStorage<C>, 
[src]

type Type = &'a mut C

Type of joined components.

type Value = &'a mut D

Type of joined storages.

type Mask = &'a BitSet

Type of joined bit mask.

fn join(self) -> JoinIter<Self>[src]

Create a joined iterator over the contents.

fn maybe(self) -> MaybeJoin<Self>[src]

Returns a Join-able structure that yields all indices, returning None for all missing elements and Some(T) for found elements. Read more

fn is_unconstrained() -> bool[src]

If this Join typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter/ParJoin to go through all indices which is usually not what is wanted and will kill performance. Read more

impl<C, D, I> Tracked for Storage<C, D, I> where
    D: Tracked + UnprotectedStorage<C>,
    C: Component
[src]

Auto Trait Implementations

impl<C, D, I> Send for Storage<C, D, I> where
    C: Send,
    D: Send,
    I: Send

impl<C, D, I> Sync for Storage<C, D, I> where
    C: Sync,
    D: Sync,
    I: Sync

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

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

impl<T> Any for T where
    T: Any

impl<T> TryDefault for T where
    T: Default
[src]

fn unwrap_default() -> Self[src]

Calls try_default and panics on an error case.

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]

impl<T> Erased for T

impl<T> Erased for T