@@ -95,23 +95,15 @@ struct CurrentTokioRuntime;
9595
9696impl Executor for CurrentTokioRuntime {
9797 fn spawn ( & self , fut : BoxFuture < ' static , ( ) > ) -> AbortHandleRef {
98- Box :: new ( tokio:: runtime:: Handle :: current ( ) . spawn ( fut) . abort_handle ( ) )
98+ Executor :: spawn ( & tokio:: runtime:: Handle :: current ( ) , fut)
9999 }
100100
101101 fn spawn_cpu ( & self , cpu : Box < dyn FnOnce ( ) + Send + ' static > ) -> AbortHandleRef {
102- Box :: new (
103- tokio:: runtime:: Handle :: current ( )
104- . spawn ( async move { cpu ( ) } )
105- . abort_handle ( ) ,
106- )
102+ Executor :: spawn_cpu ( & tokio:: runtime:: Handle :: current ( ) , cpu)
107103 }
108104
109105 fn spawn_blocking_io ( & self , task : Box < dyn FnOnce ( ) + Send + ' static > ) -> AbortHandleRef {
110- Box :: new (
111- tokio:: runtime:: Handle :: current ( )
112- . spawn_blocking ( task)
113- . abort_handle ( ) ,
114- )
106+ Executor :: spawn_blocking_io ( & tokio:: runtime:: Handle :: current ( ) , task)
115107 }
116108}
117109
@@ -159,13 +151,11 @@ impl BlockingRuntime for TokioRuntime {
159151 }
160152}
161153
162- #[ cfg( feature = "tokio" ) ]
163154pub struct TokioBlockingIterator < ' a , T > {
164155 handle : Arc < tokio:: runtime:: Handle > ,
165156 stream : futures:: stream:: BoxStream < ' a , T > ,
166157}
167158
168- #[ cfg( feature = "tokio" ) ]
169159impl < T > Iterator for TokioBlockingIterator < ' _ , T > {
170160 type Item = T ;
171161
0 commit comments