diff options
author | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
commit | 07aa59a122cc5e14d2fb2e2c6e3d8f82e4397bde (patch) | |
tree | 0ac63f5262d97d3d7f50ab1c72d1ace61935608c /ecs/src/actions.rs | |
parent | e9074af15cae7b3c354e524e9fa78cbddb20ff84 (diff) |
feat(ecs): add component added event
Diffstat (limited to 'ecs/src/actions.rs')
-rw-r--r-- | ecs/src/actions.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs index 7698b45..32fcfb9 100644 --- a/ecs/src/actions.rs +++ b/ecs/src/actions.rs @@ -8,7 +8,6 @@ use crate::component::{ Sequence as ComponentSequence, }; use crate::entity::Uid as EntityUid; -use crate::lock::{Lock, WriteGuard}; use crate::system::{NoInitParamFlag, Param as SystemParam, System}; use crate::{ActionQueue, World}; @@ -16,8 +15,8 @@ use crate::{ActionQueue, World}; #[derive(Debug)] pub struct Actions<'world> { - action_queue: WriteGuard<'world, ActionQueue>, - action_queue_weak: Weak<Lock<ActionQueue>>, + action_queue: &'world ActionQueue, + action_queue_weak: Weak<ActionQueue>, } impl<'world> Actions<'world> @@ -64,12 +63,10 @@ impl<'world> Actions<'world> } } - fn new(action_queue: &'world Arc<Lock<ActionQueue>>) -> Self + fn new(action_queue: &'world Arc<ActionQueue>) -> Self { Self { - action_queue: action_queue - .write_nonblock() - .expect("Failed to aquire read-write action queue lock"), + action_queue: &*action_queue, action_queue_weak: Arc::downgrade(action_queue), } } @@ -111,7 +108,7 @@ unsafe impl<'world> SystemParam<'world> for Actions<'world> #[derive(Debug, Clone)] pub struct WeakRef { - action_queue: Weak<Lock<ActionQueue>>, + action_queue: Weak<ActionQueue>, } impl WeakRef @@ -134,7 +131,7 @@ impl WeakRef #[derive(Debug, Clone)] pub struct Ref<'weak_ref> { - action_queue: Arc<Lock<ActionQueue>>, + action_queue: Arc<ActionQueue>, _pd: PhantomData<&'weak_ref ()>, } |