# secsy_world This is the world data storage component of the secsy framework. The main feature of this crate is the `World` type, which is an ECS-ish data storage structure which stores the component data of the entities within it. Entities are referred to by their IDs, which are then used to get or set the data corresponding to that entity ID. A `World` can also be queried for a type, which returns a vector of IDs for entities which have a component of that type. This vector can then be used to run code for every entity with that type, or, for example, be checked against a query for a different type, so that traditional data-oriented game programming patterns may be employed. ## Example ```rust use secsy::secsy_world; use secsy_world::entities::*; use secsy_world::world::*; fn main() { let mut world = World::new(); let a = secsy_ecs::spawn_entity_with!(world, 1, 2.0, (3, 3), '4', "5"); let b = secsy_ecs::spawn_entity_with!(world, 1.0, (2, 2), '3', "4"); let c = secsy_ecs::spawn_entity_with!(world, 1, (2, 2), '3', "4"); let d = secsy_ecs::spawn_entity_with!(world, 1, 2.0, '3', "4"); let e = secsy_ecs::spawn_entity_with!(world, 1, 2.0, (3, 3), "4"); let e = secsy_ecs::spawn_entity_with!(world, 1, 2.0, (3, 3), '4'); let f = secsy_ecs::spawn_entity_with!(world, 1.0, (2, 2), '3'); let g = secsy_ecs::spawn_entity_with!(world, 1, (2, 2), "3"); let h = secsy_ecs::spawn_entity_with!(world, 1, 2.0, '3', "4"); let i = secsy_ecs::spawn_entity_with!(world, 1, (2, 2), "3"); let j = secsy_ecs::spawn_entity_with!(world, 1.0, (2, 2), '3'); let qi = world.query::().unwrap(); let qf = world.query::().unwrap(); let qt = world.query::<(i32, i32)>().unwrap(); let qc = world.query::().unwrap(); let qs = world.query::<&str>().unwrap(); let has_ints_and_chars: Vec = qi.iter().filter(|i| qc.contains(i)).cloned().collect(); let has_floats_and_strings: Vec = qf.iter().filter(|i| qs.contains(i)).cloned().collect(); let has_tuples_and_ints: Vec = qt.iter().filter(|i| qi.contains(i)).cloned().collect(); println!("{:?}", has_ints_and_chars); println!("{:?}", has_floats_and_strings); println!("{:?}", has_tuples_and_ints); } ```