Struct specs_static::Storage
[−]
[src]
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]
C: Component,
D: UnprotectedStorage<C>,
I: Id,
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: UnprotectedStorage<C>, I> Default for Storage<C, D, I> where
D: Default, [src]
D: Default,
impl<C, D, I> Drop for Storage<C, D, I> where
D: UnprotectedStorage<C>, [src]
D: UnprotectedStorage<C>,
impl<'a, C, D, I> Join for &'a Storage<C, D, I> where
D: UnprotectedStorage<C>, [src]
D: UnprotectedStorage<C>,
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 open(self) -> (Self::Mask, Self::Value)[src]
Open this join by returning the mask and the storages.
unsafe fn get(value: &mut Self::Value, id: u32) -> Self::Type[src]
Get a joined component value by a given index.
fn join(self) -> JoinIter<Self>[src]
Create a joined iterator over the contents.
impl<'a, C, D, I> Join for &'a mut Storage<C, D, I> where
D: UnprotectedStorage<C>, [src]
D: UnprotectedStorage<C>,
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 open(self) -> (Self::Mask, Self::Value)[src]
Open this join by returning the mask and the storages.
unsafe fn get(value: &mut Self::Value, id: u32) -> Self::Type[src]
Get a joined component value by a given index.
fn join(self) -> JoinIter<Self>[src]
Create a joined iterator over the contents.