1pub(crate) use std::any::{Any, TypeId};
10
11pub type Entity = usize;
13
14pub mod component;
15pub use component::{Component, ComponentKey};
16
17mod world;
18pub use world::World;
19
20pub mod query;
21pub use query::{Exclude, Filter, Query, Queryable};
22
23pub mod system;
24pub use system::{QuerySystem, System, SystemManager};
25
26#[cfg(test)]
27mod tests {
28 use super::*;
29
30 struct Tag;
31 crate::component!(Tag);
32 #[allow(dead_code)]
33 struct Name(String);
34 crate::component!(Name);
35 #[allow(dead_code)]
36 struct Point(i32, i32);
37 crate::component!(Point);
38
39 #[test]
40 fn stress() {
41 let mut world = World::new();
42
43 for i in 0..10000 {
44 let entity = world.spawn();
45 world.add(entity, Tag);
46 world.add(entity, Point(i, 65));
47 world.add(entity, Name("Cronus".to_string()));
48 }
49
50 assert!(world.has::<Tag>(3));
51 }
52}