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

Check if storage has entity_id

Get the raw index from entity_id in storage

Get the Id from index in storage

Remove entity by entity_id

Swap two items by their indices

Get how many item in storage

Provided methods

Check if storage is empty

Implementors