summaryrefslogtreecommitdiff
path: root/ecs/src/actions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/actions.rs')
-rw-r--r--ecs/src/actions.rs68
1 files changed, 0 insertions, 68 deletions
diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs
index 549e341..3d8afe6 100644
--- a/ecs/src/actions.rs
+++ b/ecs/src/actions.rs
@@ -1,7 +1,3 @@
-use std::any::type_name;
-use std::marker::PhantomData;
-use std::rc::{Rc, Weak};
-
use crate::component::{Parts as ComponentParts, Sequence as ComponentSequence};
use crate::event::component::Removed;
use crate::pair::Pair;
@@ -151,28 +147,6 @@ impl Actions<'_>
{
self.action_queue.push(Action::Stop);
}
-
- /// Returns a struct which holds a weak reference to the [`World`] that `Actions`
- /// references and that can be used to aquire a new `Actions` instance if the
- /// referenced [`World`] is still alive.
- ///
- /// # Panics
- /// This function will panic if `self` was retrieved from a [`WeakRef`].
- #[must_use]
- pub fn to_weak_ref(&self) -> WeakRef
- {
- let world = self.world.unwrap_or_else(|| {
- panic!(
- "This function cannot be called if the {} was retrieved from a {}",
- type_name::<Self>(),
- type_name::<WeakRef>()
- )
- });
-
- WeakRef {
- action_queue: Rc::downgrade(&world.data.action_queue),
- }
- }
}
impl<'world> SystemParam<'world> for Actions<'world>
@@ -188,48 +162,6 @@ impl<'world> SystemParam<'world> for Actions<'world>
}
}
-#[derive(Debug, Clone)]
-pub struct WeakRef
-{
- action_queue: Weak<ActionQueue>,
-}
-
-impl WeakRef
-{
- /// Returns a struct which can be used to retrieve a [`Actions`].
- ///
- /// Returns [`None`] if the referenced [`World`] has been dropped.
- #[must_use]
- pub fn access(&self) -> Option<Ref<'_>>
- {
- Some(Ref {
- action_queue: self.action_queue.upgrade()?,
- _pd: PhantomData,
- })
- }
-}
-
-/// Intermediate between [`Actions`] and [`WeakRef`]. Contains a strong reference to
-/// a world which is not allowed direct access to.
-#[derive(Debug, Clone)]
-pub struct Ref<'weak_ref>
-{
- action_queue: Rc<ActionQueue>,
- _pd: PhantomData<&'weak_ref ()>,
-}
-
-impl Ref<'_>
-{
- #[must_use]
- pub fn to_actions(&self) -> Actions<'_>
- {
- Actions {
- action_queue: &self.action_queue,
- world: None,
- }
- }
-}
-
/// A action for a [`System`] to perform.
#[derive(Debug)]
pub(crate) enum Action