Crate rs_ecs[−][src]
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
Comp | An immutable borrow of a component. |
CompMut | A mutable borrow of a component. |
Entity | An opaque entity identifier. |
Query | Query to get an iterator over all entities with a certain combination of components. |
QueryIter | Used to iterate through the entities which match a certain Query. |
QueryMap | Provides random access to the entities which match a certain Query. |
QueryRef | 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 ECS world storing Entities and components. |
Traits
QuerySpec | Type level specification of a query for a certain set of components. |