Struct specs::Storage
[−]
[src]
pub struct Storage<'e, T, D> { /* fields omitted */ }
A wrapper around the masked storage and the generations vector.
Can be used for safe lookup of components, insertions and removes.
This is what World::read/write
fetches for the user.
Methods
impl<'e, T, D> Storage<'e, T, D> where
T: Component,
D: Deref<Target = MaskedStorage<T>>,
[src]
T: Component,
D: Deref<Target = MaskedStorage<T>>,
fn check(&self) -> CheckStorage<'e, T, D>
Returns a struct that can iterate over the entities that have it but does not return the contents of the storage.
Useful if you want to check if an entity has a component and then possibly get the component later on in the loop.
fn get_unchecked<'a>(&'a self, entry: &'a Entry<'a, 'e, T, D>) -> &'a T
Reads the data associated with the entry.
Entry
s are returned from a CheckStorage
to remove unnecessary checks.
Panics
Panics if the entry was retrieved from another storage.
impl<'e, T, D> Storage<'e, T, D> where
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
[src]
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
fn get_mut_unchecked<'a>(
&'a mut self,
entry: &'a mut Entry<'a, 'e, T, D>
) -> &'a mut T
&'a mut self,
entry: &'a mut Entry<'a, 'e, T, D>
) -> &'a mut T
Tries to mutate the data associated with an entry.
Entry
s are returned from a CheckStorage
to remove unnecessary checks.
impl<'e, T, D> Storage<'e, T, D>
[src]
fn new(entities: Fetch<'e, EntitiesRes>, data: D) -> Storage<'e, T, D>
Create a new Storage
impl<'e, T, D> Storage<'e, T, D> where
T: Component,
D: Deref<Target = MaskedStorage<T>>,
[src]
T: Component,
D: Deref<Target = MaskedStorage<T>>,
impl<'e, T, D> Storage<'e, T, D> where
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
[src]
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
fn get_mut(&mut self, e: Entity) -> Option<&mut T>
Tries to mutate the data associated with an Entity
.
fn insert(&mut self, e: Entity, v: T) -> InsertResult<T>
Inserts new data for a given Entity
.
Returns the result of the operation as a InsertResult<T>
fn remove(&mut self, e: Entity) -> Option<T>
Removes the data associated with an Entity
.
fn clear(&mut self)
Clears the contents of the storage.
Trait Implementations
impl<'a, T: Component, D> DistinctStorage for Storage<'a, T, D> where
T::Storage: DistinctStorage,
[src]
T::Storage: DistinctStorage,
impl<'a, 'e, T, D> Join for &'a Storage<'e, T, D> where
T: Component,
D: Deref<Target = MaskedStorage<T>>,
[src]
T: Component,
D: Deref<Target = MaskedStorage<T>>,
type Type = &'a T
Type of joined components.
type Value = &'a T::Storage
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
fn open(self) -> (Self::Mask, Self::Value)
Open this join by returning the mask and the storages.
unsafe fn get(v: &mut Self::Value, i: Index) -> &'a T
Get a joined component value by a given index.
fn join(self) -> JoinIter<Self> where
Self: Sized,
Self: Sized,
Create a joined iterator over the contents.
impl<'a, 'e, T, D> Not for &'a Storage<'e, T, D> where
T: Component,
D: Deref<Target = MaskedStorage<T>>,
[src]
T: Component,
D: Deref<Target = MaskedStorage<T>>,
type Output = AntiStorage<'a>
The resulting type after applying the !
operator
fn not(self) -> Self::Output
The method for the unary !
operator
impl<'a, 'e, T, D> ParJoin for &'a Storage<'e, T, D> where
T: Component,
D: Deref<Target = MaskedStorage<T>>,
T::Storage: Sync,
[src]
T: Component,
D: Deref<Target = MaskedStorage<T>>,
T::Storage: Sync,
fn par_join(self) -> JoinParIter<Self> where
Self: Sized,
Self: Sized,
Create a joined parallel iterator over the contents.
impl<'a, 'e, T, D> Join for &'a mut Storage<'e, T, D> where
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
[src]
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
type Type = &'a mut T
Type of joined components.
type Value = &'a mut T::Storage
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
fn open(self) -> (Self::Mask, Self::Value)
Open this join by returning the mask and the storages.
unsafe fn get(v: &mut Self::Value, i: Index) -> &'a mut T
Get a joined component value by a given index.
fn join(self) -> JoinIter<Self> where
Self: Sized,
Self: Sized,
Create a joined iterator over the contents.
impl<'a, 'e, T, D> ParJoin for &'a mut Storage<'e, T, D> where
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
T::Storage: Sync + DistinctStorage,
[src]
T: Component,
D: DerefMut<Target = MaskedStorage<T>>,
T::Storage: Sync + DistinctStorage,
fn par_join(self) -> JoinParIter<Self> where
Self: Sized,
Self: Sized,
Create a joined parallel iterator over the contents.