summaryrefslogtreecommitdiff
path: root/ecs/src/system.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/system.rs')
-rw-r--r--ecs/src/system.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/ecs/src/system.rs b/ecs/src/system.rs
index f8885fc..57b0756 100644
--- a/ecs/src/system.rs
+++ b/ecs/src/system.rs
@@ -4,11 +4,10 @@ use std::fmt::Debug;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::panic::{RefUnwindSafe, UnwindSafe};
-use std::ptr::addr_of;
use seq_macro::seq;
-use crate::component::{Component, FromOptionalComponent};
+use crate::component::{Component, FromOptional as FromOptionalComponent};
use crate::lock::WriteGuard;
use crate::system::util::check_params_are_compatible;
use crate::tuple::{ReduceElement as TupleReduceElement, With as TupleWith};
@@ -88,7 +87,7 @@ macro_rules! impl_system {
run: Box::new(|data, world_data| {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let data = unsafe { &*addr_of!(*data) };
+ let data = unsafe { &*std::ptr::from_ref(data) };
let me = data
.downcast_ref::<Func>()
@@ -96,16 +95,14 @@ macro_rules! impl_system {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let world_data = unsafe {
- &*(world_data as *const WorldData)
- };
+ let world_data = unsafe { &*std::ptr::from_ref(world_data) };
me.run(world_data);
}),
prepare: Box::new(|data, world_data| {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let data = unsafe { &*addr_of!(*data) };
+ let data = unsafe { &*std::ptr::from_ref(data) };
let me = data
.downcast_ref::<Func>()
@@ -113,9 +110,7 @@ macro_rules! impl_system {
// SAFETY: The caller of TypeErased::run ensures the lifetime
// is correct
- let world_data = unsafe {
- &*(world_data as *const WorldData)
- };
+ let world_data = unsafe { &*std::ptr::from_ref(world_data) };
me.prepare(world_data);
}),