diff options
author | HampusM <hampus@hampusmat.com> | 2024-08-10 18:50:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-08-10 20:56:39 +0200 |
commit | 93f764e1003bb6f35b56b7b91a73ae0ca80282c9 (patch) | |
tree | 1765bd3ba2e61783e3477211eb84550726e0b7d9 /ecs/src/system/stateful.rs | |
parent | b4be1c1e9a7e69a86a5aa9be6699847edc2c8d0f (diff) |
refactor(ecs): create archetype lookup entries on-the-go
Diffstat (limited to 'ecs/src/system/stateful.rs')
-rw-r--r-- | ecs/src/system/stateful.rs | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs index dd0c5e1..99b56c1 100644 --- a/ecs/src/system/stateful.rs +++ b/ecs/src/system/stateful.rs @@ -21,7 +21,7 @@ use crate::tuple::{ TakeOptionElementResult as TupleTakeOptionElementResult, WithOptionElements as TupleWithOptionElements, }; -use crate::{World, WorldData}; +use crate::World; /// A stateful system. pub struct Stateful<Func> @@ -85,13 +85,6 @@ macro_rules! impl_system { self } - fn prepare(&self, world_data: &WorldData) - { - #( - TParam~I::prepare(world_data); - )* - } - fn run<'this>(&'this self, world: &'world World) where 'this: 'world @@ -124,19 +117,6 @@ macro_rules! impl_system { me.run(world); }), - prepare: Box::new(|data, world| { - // SAFETY: The caller of TypeErased::run ensures the lifetime - // is correct - let data = unsafe { &*std::ptr::from_ref::<dyn Any>(data) }; - - let me = data.downcast_ref::<Self>().unwrap(); - - // SAFETY: The caller of TypeErased::run ensures the lifetime - // is correct - let world = unsafe { &*std::ptr::from_ref(world) }; - - me.prepare(world); - }), } } |