Crate planck_ecs

Source
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§

ComponentIterator
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.
ComponentIteratorMut
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 using Entities.
Dispatcher
A dispatcher is used to execute a collection of System in order and possibly in parallel using World’s resources. A dispatcher automatically avoids mutable borrow collisions which would normally lead to data corruption, dead locks and more.
DispatcherBuilder
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 with Components structs.
EntityIterator
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.
IntoSystem
Converts a function into a System. It is required to execute a function automatically from World’s resources. This trait is automatically implemented for functions taking 12 arguments (22 if using the big_systems feature) or less where:
WorldExt
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§

BitSetVec
The type of bitsets used to track entities in component storages. Mostly used to create caches.
SystemResult
The result of a System’s execution. Returns Ok(()) on success, EcsError on failure. To return a custom error from a system, use the system_error! macro.