Expand description
A minimalist, safe and fast ECS. Composed of two libraries:
- entity_component
- world_dispatcher
Planck ECS is a library that brings those two smaller parts together.
It adds the maintain
function to world, which takes care of cleaning up
dead entities after running systems.
Macros§
- izip
- Create an iterator running multiple iterators in lockstep.
- join
- The join macro makes it very easy to iterate over multiple
components of the same
Entity
at once. - system_
error - Returns a custom error from a
System
during execution.
Structs§
- Component
Iterator - Iterates over components using a provided bitset.
Each time the bitset has a 1 in index i, the iterator will fetch data
from the storage at index i and return it as an
Option
. - Component
Iterator Mut - Iterates over components using a provided bitset.
Each time the bitset has a 1 in index i, the iterator will fetch data
from the storage at index i and return it as an
Option
. - Components
- Holds components of a given type indexed by
Entity
. We do not check if the given entity is alive here, this should be done usingEntities
. - Dispatcher
- A dispatcher is used to execute a collection of
System
in order and possibly in parallel usingWorld
’s resources. A dispatcher automatically avoids mutable borrow collisions which would normally lead to data corruption, dead locks and more. - Dispatcher
Builder - A builder that accumulates systems to be inserted into a
Dispatcher
. - Entities
- Holds a list of alive entities. It also holds a list of entities that were recently killed, which allows to remove components of deleted entities at the end of a game frame.
- Entity
- An entity index.
They are created using the
Entities
struct. They are used as indices withComponents
structs. - Entity
Iterator - Iterator over entities using the provided bitset.
- System
- Struct used to run a system function using the world.
This struct is also used internally by the
Dispatcher
to create a coherent execution sequence. - World
- Contains data indexed by type. World allows to dynamically enforce the rust rules of borrowing and ownership at runtime:
Enums§
- EcsError
- The types of errors a
System
can create.
Traits§
- BitSet
- The BitSet API.
- Into
System - Converts a function into a
System
. It is required to execute a function automatically fromWorld
’s resources. This trait is automatically implemented for functions taking 12 arguments (22 if using thebig_systems
feature) or less where: - World
Ext - Extension to the
World
struct that adds a maintain() method.
Functions§
- create_
bitset - Creates a bitset big enough to contain the index of each entity. Mostly used to create caches.
Type Aliases§
- BitSet
Vec - The type of bitsets used to track entities in component storages. Mostly used to create caches.
- System
Result - The result of a
System
’s execution. Returns Ok(()) on success,EcsError
on failure. To return a custom error from a system, use thesystem_error!
macro.