summaryrefslogtreecommitdiff
path: root/ecs/src/system/stateful.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-29 18:41:04 +0200
committerHampusM <hampus@hampusmat.com>2024-06-29 18:41:04 +0200
commit93f9f840da11b82c8a13f31f0ba5db8b10e4e9ad (patch)
treef92798d7c1efcaa1b4e8d44215c7e3459f349498 /ecs/src/system/stateful.rs
parent4793e4411d98d97f879023dc072f3847201d49da (diff)
refactor(ecs): pass World ref to system run & param new functions
Diffstat (limited to 'ecs/src/system/stateful.rs')
-rw-r--r--ecs/src/system/stateful.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs
index 56c9d4f..26ceaaa 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::WorldData;
+use crate::{World, WorldData};
/// A stateful system.
pub struct Stateful<Func>
@@ -92,7 +92,7 @@ macro_rules! impl_system {
)*
}
- fn run<'this>(&'this self, world_data: &'world WorldData)
+ fn run<'this>(&'this self, world: &'world World)
where
'this: 'world
{
@@ -103,7 +103,7 @@ macro_rules! impl_system {
let func = self.func;
func(#({
- TParam~I::new(self, world_data)
+ TParam~I::new(self, &world)
},)*);
}
@@ -111,7 +111,7 @@ macro_rules! impl_system {
{
TypeErased {
data: Box::new(self),
- run: Box::new(|data, world_data| {
+ run: 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) };
@@ -120,11 +120,11 @@ macro_rules! impl_system {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let world_data = unsafe { &*std::ptr::from_ref(world_data) };
+ let world = unsafe { &*std::ptr::from_ref(world) };
- me.run(world_data);
+ me.run(world);
}),
- prepare: Box::new(|data, world_data| {
+ 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) };
@@ -133,9 +133,9 @@ macro_rules! impl_system {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let world_data = unsafe { &*std::ptr::from_ref(world_data) };
+ let world = unsafe { &*std::ptr::from_ref(world) };
- me.prepare(world_data);
+ me.prepare(world);
}),
}
}