pub struct TypedComponentOps<T>(_);
Expand description

Implements typed operations on top of a UntypedComponentStore.

This is a utility used to help represent the unsafty of interpreting the UntypedComponentStore as a particular type.

It is unsafe to construct a TypedComponentOps to indicate that you are taking responsibility for only calling it’s functions on an UntypedComponentStore that actually corresponds to the type T that the TypedComponentOps was created for.

Note: The alternative to this approach would be to make every method of this type unsafe, which may be a better option. It really seems like a matter of preference, but if you have an opinion, @zicklag would be happy to discuss on GitHub!

Implementations§

Safety

Creating TypedComponentOps must only be used on an UntypedComponentStore where the underlying, untyped component data is valid for T.

Insert a component into the store.

Borrow a component in the store, if it exists for the given entity.

Mutably borrow a component in the store, if it exists for the given entity.

Remove a component from an entity, returning the previous component if one existed.

Iterate over all components in the store.

Mutably iterate over all components in the store.

Iterate over all the components in the store that match the entities in the given bitset.

Mutably iterate over all the components in the store that match the entities in the given bitset.

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.