浏览代码

Merge pull request #840 from mirkootter/master

Jon Kelley 2 年之前
父节点
当前提交
133e2b4d05
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 6 0
      packages/hooks/src/usecoroutine.rs
  2. 1 1
      packages/hooks/src/usestate.rs

+ 6 - 0
packages/hooks/src/usecoroutine.rs

@@ -108,6 +108,12 @@ impl<T> Coroutine<T> {
     }
 }
 
+impl<T> PartialEq for Coroutine<T> {
+    fn eq(&self, other: &Self) -> bool {
+        self.task == other.task
+    }
+}
+
 #[cfg(test)]
 mod tests {
     #![allow(unused)]

+ 1 - 1
packages/hooks/src/usestate.rs

@@ -329,7 +329,7 @@ impl PartialEq<bool> for &UseState<bool> {
     }
 }
 
-impl<T: PartialEq> PartialEq<UseState<T>> for UseState<T> {
+impl<T> PartialEq<UseState<T>> for UseState<T> {
     fn eq(&self, other: &UseState<T>) -> bool {
         Rc::ptr_eq(&self.current_val, &other.current_val)
     }