1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
//! A reasonably simple entity component system (ECS). //! //! The design is based on [hecs](https://github.com/Ralith/hecs) but it is not thread-safe //! and has a significantly reduced API surface. //! //! # Example //! //! ``` //! # use rs_ecs::*; //! //! 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); //! } //! ``` #![warn(missing_docs)] mod archetype; mod query; mod resources; mod world; pub use crate::{ archetype::{Comp, CompMut}, query::{Query, QueryIter, QueryMap, QueryRef, QuerySpec, With, Without}, resources::{Res, ResMut, Resources}, world::{Entity, World}, };