From 1e85e99aa0bf606cf3eb3cbab413180d76c117a5 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Tue, 6 Feb 2024 15:04:45 +0000 Subject: [PATCH] Added `Effect::inner_ptr`. --- dynatos-reactive/src/effect.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dynatos-reactive/src/effect.rs b/dynatos-reactive/src/effect.rs index 59c0995..70a56a8 100644 --- a/dynatos-reactive/src/effect.rs +++ b/dynatos-reactive/src/effect.rs @@ -86,6 +86,13 @@ impl Effect { Rc::strong_count(&self.inner) == 1 && Rc::weak_count(&self.inner) == 0 } + /// Returns the pointer of this effect + /// + /// This can be used for creating maps based on equality + pub fn inner_ptr(&self) -> *const () { + Rc::as_ptr(&self.inner).cast() + } + /// Runs the effect pub fn run(&self) { // Push the effect, run the closure and pop it