Expand description
A reasonably simple entity component system (ECS).
The design is based on hecs but it is not thread-safe and has a significantly reduced API surface.
§Example
let mut world = World::new();
let entity = world.alloc();
world.insert(entity, (42_u32, true));
let entity = world.alloc();
world.insert(entity, (23_u32, "hello".to_string()));
for number in Query::<&u32>::new().borrow(&world).iter() {
println!("{}", number);
}
for (_entity, number, string) in Query::<(&Entity, &u32, &String)>::new().borrow(&world).iter() {
println!("{}, {}", string, number);
}
Structs§
- Cloner
- Collects component types which can be cloned or copied
- Entity
- An opaque entity identifier.
- Matches
- A query specification to indicate which entities match the inner query, but without borrowing any components.
- Query
- Query to get an iterator over all entities with a certain combination of components.
- Query
Iter - Used to iterate through the entities which match a certain Query.
- Query
Map - Provides random access to the entities which match a certain Query.
- Query
One - Query to access the specified components of a single entity.
- Query
ParIter - Used to iterate through the entities which match a certain Query in parallel.
- Query
Ref - Borrow of the World for a Query. Required to obtain an iterator.
- Res
- An immutable borrow of a resource.
- ResMut
- A mutable borrow of a resource.
- Resources
- A type map for holding resources.
- With
- A query specification to iterate over entities with a certain component, but without borrowing that component.
- Without
- A query specification to iterate over entities without a certain component.
- World
- The world storing entities and their components.
Traits§
- Query
Spec - Type level specification of a query for a certain set of components.