From 93f764e1003bb6f35b56b7b91a73ae0ca80282c9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 10 Aug 2024 18:50:45 +0200 Subject: refactor(ecs): create archetype lookup entries on-the-go --- ecs/src/system/stateful.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'ecs/src/system') 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 @@ -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::(data) }; - - let me = data.downcast_ref::().unwrap(); - - // SAFETY: The caller of TypeErased::run ensures the lifetime - // is correct - let world = unsafe { &*std::ptr::from_ref(world) }; - - me.prepare(world); - }), } } -- cgit v1.2.3-18-g5258