pub struct ComponentStore<T>where
    T: TypedEcsData,
{ /* private fields */ }
Expand description

A typed wrapper around UntypedComponentStore.

Implementations§

Create a new ComponentStore<T> by wrapping an UntypedComponentStore.

This method is safe because T is required to implement [Pod], which means T is valid for any bit pattern.

Panics

This will panic if the layout of T does not match the layout of components.

Create a new ComponentStore<T> by wrapping an UntypedComponentStore.

Safety

The data stored in components data must be a valid bit pattern for the given type T.

Note: If T implements [Pod] you can safely create an instance of ComponentStore with from_components.

Converts to the internal, untyped ComponentStore.

Inserts a component for the given Entity index. Returns the previous component, if any.

Gets an immutable reference to the component of Entity.

Gets a mutable reference to the component of Entity.

Removes the component of Entity. Returns Some(T) if the entity did have the component. Returns None if the entity did not have the component.

Iterates immutably over all components of this type. Very fast but doesn’t allow joining with other component types.

Iterates mutably over all components of this type. Very fast but doesn’t allow joining with other component types.

Iterates immutably over the components of this type where bitset indicates the indices of entities. Slower than iter() but allows joining between multiple component types.

Iterates mutable over the components of this type where bitset indicates the indices of entities. Slower than iter() but allows joining between multiple component types.

Read the bitset containing the list of entites with this component type on it.

Check whether or not this component store has data for the given entity.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.