Module bevy::ecs::storage

Expand description

Storage layouts for ECS data.

This module implements the low-level collections that store data in a World. These all offer minimal and often unsafe APIs, and have been made pub primarily for debugging and monitoring purposes.

§Fetching Storages

Each of the below data stores can be fetched via Storages, which can be fetched from a World via World::storages. It exposes a top level container for each class of storage within ECS:

  • Tables - columnar contiguous blocks of memory, optimized for fast iteration.
  • SparseSets - sparse HashMap-like mappings from entities to components, optimized for random lookup and regular insertion/removal of components.
  • Resources - singleton storage for the resources in the world


To avoid trivially unsound use of the APIs in this module, it is explicitly impossible to get a mutable reference to Storages from World, and none of the types publicly expose a mutable interface.