Struct keeshond::scene::ComponentStore[][src]

pub struct ComponentStore<C: Component + 'static> { /* fields omitted */ }
Expand description

Stores all instances of a Component for a given type, indexed based on the Entities they belong to.

Implementations

Returns an immutable reference to the Component for the given Entity, or None if it does not exist.

Returns a mutable reference to the Component for the given Entity, or None if it does not exist.

Returns a clone of the Component for the given Entity. This is useful for getting around issues with the Rust borrow checker preventing you from accessing more than one component in the store at a time.

Sets the Component for the given Entity in the store. Useful to “commit” changes to a component that you cloned previously with [clone_from_entity()]. Returns true if there is a component for the given entity.

Returns an immutable reference to the “n-th” Component in the store. This is primarily useful for when you want to get the first, last, or random component, etc. The index you use here should not be cached, as the components may move around in the store. In most cases you should use [get_entity()] instead.

Returns a mutable reference to the “n-th” Component in the store. This is primarily useful for when you want to get the first, last, or random component, etc. The index you use here should not be cached, as the components may move around in the store. In most cases you should use [get_entity_mut()] instead.

Returns the number of Entities with this Component

Returns true if there is a Component for the given Entity

Returns a ComponentIter that iterates through all Components in the store. Typically used in a DrawerSystem.

Returns a ComponentIterMut that iterates through all Components in the store. Typically used in a ThinkerSystem.

Trait Implementations

Formats the value using the given formatter. 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

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

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<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

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

Performs the conversion.

Performs the conversion.

Should always be Self

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.