[]Struct amethyst::ecs::prelude::Storage

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
    D: Deref<Target = MaskedStorage<T>>,
    T: Component

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
    D: DerefMut<Target = MaskedStorage<T>>,
    T: Component

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

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
    D: Deref<Target = MaskedStorage<T>>,
    T: Component,
    <T as Component>::Storage: Tracked

Returns the event channel tracking modified components.

Returns the event channel tracking modified components.

Returns the event channel tracking inserted components.

Returns the event channel tracking removed components.

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

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

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

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

Returns all of the event channels for this component.

Returns the event channel tracking modified components mutably.

Returns the event channel tracking inserted components mutably.

Returns the event channel tracking removed components mutably.

Starts tracking modified events.

Starts tracking inserted events.

Starts tracking removed events.

Flags an index as modified.

Flags an index as inserted.

Flags an index as removed.

impl<'e, T, D> Storage<'e, T, D>

Create a new Storage

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

Gets the wrapped storage.

Tries to read the data associated with an Entity.

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

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
    D: DerefMut<Target = MaskedStorage<T>>,
    T: Component

Gets mutable access to the wrapped storage.

This is unsafe because modifying the wrapped storage without also updating the mask bitset accordingly can result in illegal memory access.

Tries to mutate the data associated with an Entity.

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 });
 }

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

Removes the data associated with an Entity.

Clears the contents of the storage.

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

Trait Implementations

impl<'a, 'e, T, D> Not for &'a Storage<'e, T, D> where
    D: Deref<Target = MaskedStorage<T>>,
    T: Component

The resulting type after applying the ! operator.

Performs the unary ! operation.

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

Create a joined parallel iterator over the contents.

impl<'a, 'e, T, D> ParJoin for &'a mut Storage<'e, T, D> where
    D: DerefMut<Target = MaskedStorage<T>>,
    T: Component,
    <T as Component>::Storage: Sync,
    <T as Component>::Storage: DistinctStorage

Create a joined parallel iterator over the contents.

impl<'a, T, D> DistinctStorage for Storage<'a, T, D> where
    T: Component,
    <T as Component>::Storage: DistinctStorage

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

Type of joined components.

Type of joined storages.

Type of joined bit mask.

Open this join by returning the mask and the storages. Read more

Get a joined component value by a given index.

Important traits for JoinIter<J>

Create a joined iterator over the contents.

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

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, 'e, T, D> Join for &'a mut Storage<'e, T, D> where
    D: DerefMut<Target = MaskedStorage<T>>,
    T: Component

Type of joined components.

Type of joined storages.

Type of joined bit mask.

Open this join by returning the mask and the storages. Read more

Get a joined component value by a given index.

Important traits for JoinIter<J>

Create a joined iterator over the contents.

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

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, 'b, T> GenericReadStorage for &'b Storage<'a, T, Fetch<'a, MaskedStorage<T>>> where
    'a: 'b,
    T: Component

The component type of the storage

Get immutable access to an Entitys component

Private function to seal the trait

impl<'a, 'b, T> GenericReadStorage for &'b Storage<'a, T, FetchMut<'a, MaskedStorage<T>>> where
    'a: 'b,
    T: Component

The component type of the storage

Get immutable access to an Entitys component

Private function to seal the trait

impl<'a, T> GenericReadStorage for Storage<'a, T, Fetch<'a, MaskedStorage<T>>> where
    T: Component

The component type of the storage

Get immutable access to an Entitys component

Private function to seal the trait

impl<'a, T> GenericReadStorage for Storage<'a, T, FetchMut<'a, MaskedStorage<T>>> where
    T: Component

The component type of the storage

Get immutable access to an Entitys component

Private function to seal the trait

impl<'a, T> SystemData<'a> for Storage<'a, T, FetchMut<'a, MaskedStorage<T>>> where
    T: Component

Sets up the system data for fetching it from the Resources.

Fetches the system data from Resources. Note that this is only specified for one concrete lifetime 'a, you need to implement the SystemData trait for every possible lifetime. Read more

Returns all read dependencies as fetched from Self::fetch. Read more

Returns all write dependencies as fetched from Self::fetch. Read more

impl<'a, T> SystemData<'a> for Storage<'a, T, Fetch<'a, MaskedStorage<T>>> where
    T: Component

Sets up the system data for fetching it from the Resources.

Fetches the system data from Resources. Note that this is only specified for one concrete lifetime 'a, you need to implement the SystemData trait for every possible lifetime. Read more

Returns all read dependencies as fetched from Self::fetch. Read more

Returns all write dependencies as fetched from Self::fetch. Read more

impl<'a, T> GenericWriteStorage for Storage<'a, T, FetchMut<'a, MaskedStorage<T>>> where
    T: Component

The component type of the storage

Get mutable access to an Entitys component

Insert a component for an Entity

Remove the component for an Entity

Private function to seal the trait

impl<'a, 'b, T> GenericWriteStorage for &'b mut Storage<'a, T, FetchMut<'a, MaskedStorage<T>>> where
    'a: 'b,
    T: Component

The component type of the storage

Get mutable access to an Entitys component

Insert a component for an Entity

Remove the component for an Entity

Private function to seal the trait

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

Blanket Implementations

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

Performs the conversion.

impl<T> From for T
[src]

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Immutably borrows from an owned value. Read more

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

Mutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

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

impl<T> Any for T where
    T: Any

impl<'a, T> DynamicSystemData for T where
    T: SystemData<'a>, 

The accessor of the SystemData, which specifies the read and write dependencies and does the fetching. Read more

Sets up Resources for fetching this system data.

Creates a new resource bundle by fetching the required resources from the [Resources] struct. Read more

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

impl<T> Erased for T

impl<T> Downcast for T where
    T: Any

Convert Box<Trait> (where Trait: Downcast) to Box<Any>. Box<Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any's vtable from &Trait's. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any's vtable from &mut Trait's. Read more

impl<T> SetParameter for T

Sets value as a parameter of self.