From 9ac82101963e1aab9920495013ccee3ab62d2128 Mon Sep 17 00:00:00 2001 From: Jan-Mirko Otter Date: Wed, 22 Feb 2023 20:26:21 +0100 Subject: [PATCH] PartialEq for UseState/UseCoroutine --- packages/hooks/src/usecoroutine.rs | 6 ++++++ packages/hooks/src/usestate.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/hooks/src/usecoroutine.rs b/packages/hooks/src/usecoroutine.rs index 2f2442f87..bc97735b9 100644 --- a/packages/hooks/src/usecoroutine.rs +++ b/packages/hooks/src/usecoroutine.rs @@ -108,6 +108,12 @@ impl Coroutine { } } +impl PartialEq for Coroutine { + fn eq(&self, other: &Self) -> bool { + self.task == other.task + } +} + #[cfg(test)] mod tests { #![allow(unused)] diff --git a/packages/hooks/src/usestate.rs b/packages/hooks/src/usestate.rs index 2e1aa7295..d2b6db6fc 100644 --- a/packages/hooks/src/usestate.rs +++ b/packages/hooks/src/usestate.rs @@ -329,7 +329,7 @@ impl PartialEq for &UseState { } } -impl PartialEq> for UseState { +impl PartialEq> for UseState { fn eq(&self, other: &UseState) -> bool { Rc::ptr_eq(&self.current_val, &other.current_val) }