瀏覽代碼

implement copy for Resource

Evan Almloff 1 年之前
父節點
當前提交
81e0469cc2
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      packages/hooks/src/use_resource.rs

+ 7 - 0
packages/hooks/src/use_resource.rs

@@ -107,6 +107,13 @@ pub struct Resource<T: 'static> {
     callback: UseCallback<Task>,
 }
 
+impl<T> Clone for Resource<T> {
+    fn clone(&self) -> Self {
+        *self
+    }
+}
+impl<T> Copy for Resource<T> {}
+
 /// A signal that represents the state of the resource
 // we might add more states (panicked, etc)
 #[derive(Clone, Copy, PartialEq, Hash, Eq, Debug)]