Module storage

Source
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

§Safety

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.

Structs§

Column
A type-erased contiguous container for data of a homogeneous type.
ComponentSparseSet
A sparse data structure of Components.
ResourceData
The type-erased backing storage and metadata for a single resource within a World.
Resources
The backing store for all Resources stored in the World.
SparseSet
A data structure that blends dense and sparse storage
SparseSets
A collection of ComponentSparseSet storages, indexed by ComponentId
Storages
The raw data stores of a World
Table
A column-oriented structure-of-arrays based storage for Components of entities in a World.
TableId
An opaque unique ID for a Table within a World.
TableRow
A opaque newtype for rows in Tables. Specifies a single row in a specific table.
Tables
A collection of Table storages, indexed by TableId
ThinColumn
Very similar to a normal Column, but with the capacities and lengths cut out for performance reasons.

Traits§

SparseSetIndex
Represents something that can be stored in a SparseSet as an integer.