Struct specs::storage::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<'st, T, D> Storage<'st, T, D> where
    T: Component,
    D: Deref<Target = MaskedStorage<T>>, 
[src]

[src]

Builds an immutable RestrictedStorage out of a Storage. Allows deferred unchecked access to the entity's component.

This is returned as a ParallelRestriction version since you can only get immutable components with this which is safe for parallel by default.

impl<'st, T, D> Storage<'st, T, D> where
    T: Component,
    D: DerefMut<Target = MaskedStorage<T>>, 
[src]

[src]

Builds a mutable RestrictedStorage out of a Storage. Allows restricted access to the inner components without allowing invalidating the bitset for iteration in Join.

[src]

Builds a mutable, parallel RestrictedStorage, does not allow mutably getting other components aside from the current iteration.

impl<'e, T, D> Storage<'e, T, D> where
    T: Component,
    T::Storage: Tracked,
    D: Deref<Target = MaskedStorage<T>>, 
[src]

[src]

Returns the event channel tracking modified components.

[src]

Returns the event channel tracking modified components.

[src]

Returns the event channel tracking inserted components.

[src]

Returns the event channel tracking removed components.

[src]

Reads events from the modified EventChannel and populates a structure using the events.

[src]

Reads events from the inserted EventChannel and populates a structure using the events.

[src]

Reads events from the removed EventChannel and populates a structure using the events.

impl<'e, T, D> Storage<'e, T, D> where
    T: Component,
    T::Storage: Tracked,
    D: DerefMut<Target = MaskedStorage<T>>, 
[src]

[src]

Returns all of the event channels for this component.

[src]

Returns the event channel tracking modified components mutably.

[src]

Returns the event channel tracking inserted components mutably.

[src]

Returns the event channel tracking removed components mutably.

[src]

Starts tracking modified events.

[src]

Starts tracking inserted events.

[src]

Starts tracking removed events.

[src]

Flags an index as modified.

[src]

Flags an index as inserted.

[src]

Flags an index as removed.

impl<'e, T, D> Storage<'e, T, D>
[src]

[src]

Create a new Storage

impl<'e, T, D> Storage<'e, T, D> where
    T: Component,
    D: Deref<Target = MaskedStorage<T>>, 
[src]

[src]

Tries to read the data associated with an Entity.

[src]

Returns true if the storage has a component for this entity, and that entity is alive.

[src]

Returns a reference to the bitset of this storage which allows filtering by the component type without actually getting the component.

impl<'e, T, D> Storage<'e, T, D> where
    T: Component,
    D: DerefMut<Target = MaskedStorage<T>>, 
[src]

[src]

Tries to mutate the data associated with an Entity.

[src]

Returns an entry to the component associated to the entity.

Behaves somewhat similarly to std::collections::HashMap's entry api.

Example

 if let Ok(entry) = storage.entry(entity) {
     entry.or_insert(Comp { field: 55 });
 }

[src]

Inserts new data for a given Entity. Returns the result of the operation as a InsertResult<T>

[src]

Removes the data associated with an Entity.

[src]

Clears the contents of the storage.

[src]

Creates a draining storage wrapper which can be .joined to get a draining iterator.

Trait Implementations

impl<'a, T: Component, D> DistinctStorage for Storage<'a, T, D> where
    T::Storage: DistinctStorage
[src]

impl<'a, 'e, T, D> Join for &'a Storage<'e, T, D> where
    T: Component,
    D: Deref<Target = MaskedStorage<T>>, 
[src]

Type of joined components.

Type of joined storages.

Type of joined bit mask.

[src]

Open this join by returning the mask and the storages.

Important traits for &'a mut W
[src]

Get a joined component value by a given index.

Important traits for JoinIter<J>
[src]

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]

The resulting type after applying the ! operator.

[src]

Performs the unary ! operation.

impl<'a, 'e, T, D> ParJoin for &'a Storage<'e, T, D> where
    T: Component,
    D: Deref<Target = MaskedStorage<T>>,
    T::Storage: Sync
[src]

[src]

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]

Type of joined components.

Type of joined storages.

Type of joined bit mask.

[src]

Open this join by returning the mask and the storages.

Important traits for &'a mut W
[src]

Get a joined component value by a given index.

Important traits for JoinIter<J>
[src]

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]

[src]

Create a joined parallel iterator over the contents.

Auto Trait Implementations

impl<'e, T, D> Send for Storage<'e, T, D> where
    D: Send,
    T: Send

impl<'e, T, D> Sync for Storage<'e, T, D> where
    D: Sync,
    T: Sync