Added Effect::inner_ptr.

This commit is contained in:
Filipe Rodrigues 2024-02-06 15:04:45 +00:00
parent 07f249b1aa
commit 1e85e99aa0
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU

View File

@ -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