pub struct SparseSet<T> { /* private fields */ }
Expand description

Default component storage.

Implementations

Returns a slice of all the components in this storage.

Returns true if entity owns a component in this storage.

Returns the length of the storage.

Returns true if the storage’s length is 0.

Returns the index of entity’s component in the dense and data vectors.
This index is only valid for this storage and until a modification happens.

Returns the index of entity’s component in the dense and data vectors.
This index is only valid for this storage and until a modification happens.

Safety

entity has to own a component of this type.
The index is only valid until a modification occurs in the storage.

Returns the EntityId at a given index.

Removes entity’s component from this storage.

Deletes entity’s component from this storage.

Returns true if entity’s component was inserted since the last clear_inserted or clear_all_inserted call.
Returns false if entity does not have a component in this storage.

Returns true if entity’s component was modified since the last clear_modified or clear_all_modified call.
Returns false if entity does not have a component in this storage.

Returns true if entity’s component was inserted or modified since the last clear call.
Returns false if entity does not have a component in this storage.

Returns the deleted components of a storage tracking deletion.

Panics

Returns the ids of removed components of a storage tracking removal.

Panics

Returns the ids of removed or deleted components of a storage tracking removal and/or deletion.

Panics

Takes ownership of the deleted components of a storage tracking deletion.

Panics

Takes ownership of the ids of removed components of a storage tracking removal.

Panics

Takes ownership of the removed and deleted components of a storage tracking removal and/or deletion.

Panics

Removes the inserted flag on entity’s component.

Panics

Removes the inserted flag on all components of this storage.

Panics

Removes the modified flag on entity’s component.

Panics

Removes the modified flag on all components of this storage.

Panics

Removes the inserted and modified flags on entity’s component.

Panics

Removes the inserted and modified flags on all components of this storage.

Panics

Flags components when they are inserted.
To check the flag use is_inserted, is_inserted_or_modified or iterate over the storage after calling inserted.
To clear the flag use clear_inserted or clear_all_inserted.

Flags components when they are modified. Will not flag components already flagged inserted.
To check the flag use is_modified, is_inserted_or_modified or iterate over the storage after calling modified.
To clear the flag use clear_modified or clear_all_modified.

Stores components and their EntityId when they are deleted.
You can access them with deleted or removed_or_deleted.
You can clear them and get back a Vec with take_deleted or take_removed_and_deleted.

Stores EntityId of deleted components.
You can access them with removed or removed_or_deleted.
You can clear them and get back a Vec with take_removed or take_removed_and_deleted.

Flags component insertion, modification, deletion and removal.
Same as calling track_insertion, track_modification, track_deletion and track_removal.

Returns true if the storage tracks insertion.

Returns true if the storage tracks modification.

Returns true if the storage tracks deletion.

Returns true if the storage tracks removal.

Returns true if the storage tracks insertion, modification, deletion or removal.

Reserves memory for at least additional components. Adding components can still allocate though.

Deletes all components in this storage.

Applies the given function f to the entities a and b.
The two entities shouldn’t point to the same component.

Panics
  • MissingComponent - if one of the entity doesn’t have any component in the storage.
  • IdenticalIds - if the two entities point to the same component.

Applies the given function f to the entities a and b.
The two entities shouldn’t point to the same component.

Panics
  • MissingComponent - if one of the entity doesn’t have any component in the storage.
  • IdenticalIds - if the two entities point to the same component.

Creates a draining iterator that empties the storage and yields the removed items.

Sorts the SparseSet with a comparator function, but may not preserve the order of equal elements.

Sorts the SparseSet, but may not preserve the order of equal elements.

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Deletes an entity from this storage.

Deletes all components of this storage.

Returns how much memory this storage uses.

Returns a SparseSet’s internal SparseArray. Read more

Casts to &dyn Any.

Casts to &mut dyn Any.

Returns the storage’s name.

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

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.