@@ -6,19 +6,8 @@ use futures_core::task::Executor as Executor03;
6
6
use futures_core:: task as task03;
7
7
use futures_core:: future:: FutureObj ;
8
8
9
- pub struct BoxedExecutor03 ( Box < dyn Executor03 + Send > ) ;
10
-
11
- impl Executor03 for BoxedExecutor03 {
12
- fn spawn_obj (
13
- & mut self ,
14
- future : FutureObj < ' static , ( ) > ,
15
- ) -> Result < ( ) , task03:: SpawnObjError > {
16
- ( & mut * self . 0 ) . spawn_obj ( future)
17
- }
18
- }
19
-
20
9
/// A future that can run on a futures 0.1 executor.
21
- pub type Executor01Future = Compat < UnitError < FutureObj < ' static , ( ) > > , BoxedExecutor03 > ;
10
+ pub type Executor01Future = Compat < UnitError < FutureObj < ' static , ( ) > > , Box < dyn Executor03 + Send > > ;
22
11
23
12
/// Extension trait for futures 0.1 Executors.
24
13
pub trait Executor01CompatExt : Executor01 < Executor01Future > +
@@ -53,7 +42,8 @@ where Ex: Executor01<Executor01Future>,
53
42
& mut self ,
54
43
future : FutureObj < ' static , ( ) > ,
55
44
) -> Result < ( ) , task03:: SpawnObjError > {
56
- let future = future. unit_error ( ) . compat ( BoxedExecutor03 ( Box :: new ( self . clone ( ) ) ) ) ;
45
+ let exec: Box < dyn Executor03 + Send > = Box :: new ( self . clone ( ) ) ;
46
+ let future = future. unit_error ( ) . compat ( exec) ;
57
47
58
48
match self . executor01 . execute ( future) {
59
49
Ok ( ( ) ) => Ok ( ( ) ) ,
0 commit comments