File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -729,6 +729,8 @@ impl<T: Clone> Deref for Resource<T> {
729729 }
730730}
731731
732+ static NEXT_RESOURCE_FUTURE_ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
733+
732734#[ derive( Debug ) ]
733735pub struct ResourceFuture < T >
734736where
@@ -759,6 +761,19 @@ where
759761 }
760762}
761763
764+ impl < T > Clone for ResourceFuture < T >
765+ where
766+ T : ' static ,
767+ {
768+ fn clone ( & self ) -> Self {
769+ let id = NEXT_RESOURCE_FUTURE_ID . fetch_add ( 1 , Ordering :: Relaxed ) ;
770+ ResourceFuture {
771+ id,
772+ resource : self . resource ,
773+ }
774+ }
775+ }
776+
762777impl < T > Drop for ResourceFuture < T >
763778where
764779 T : ' static ,
@@ -777,8 +792,7 @@ where
777792 type IntoFuture = ResourceFuture < T > ;
778793
779794 fn into_future ( self ) -> Self :: IntoFuture {
780- static NEXT_FUTURE_ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
781- let id = NEXT_FUTURE_ID . fetch_add ( 1 , Ordering :: Relaxed ) ;
795+ let id = NEXT_RESOURCE_FUTURE_ID . fetch_add ( 1 , Ordering :: Relaxed ) ;
782796 ResourceFuture { id, resource : self }
783797 }
784798}
You can’t perform that action at this time.
0 commit comments