Trait xecs::ComponentStorage
source · [−]pub trait ComponentStorage: Send + Sync {
fn has(&self, entity_id: EntityId) -> bool;
fn index(&self, entity_id: EntityId) -> Option<usize>;
fn id(&self, index: usize) -> Option<EntityId>;
fn remove(&mut self, entity_id: EntityId);
fn swap_by_index(&mut self, index_a: usize, index_b: usize);
fn count(&self) -> usize;
fn is_empty(&self) -> bool { ... }
}
Expand description
A trait to make sparse set dynamic
Required methods
Get the raw index from entity_id
in storage
fn swap_by_index(&mut self, index_a: usize, index_b: usize)
fn swap_by_index(&mut self, index_a: usize, index_b: usize)
Swap two items by their indices