@@ -67,7 +67,7 @@ use core::marker::{Unpin, Unsize};
6767use core:: mem:: { self , PinMut } ;
6868use core:: ops:: { CoerceUnsized , Deref , DerefMut , Generator , GeneratorState } ;
6969use core:: ptr:: { self , NonNull , Unique } ;
70- use core:: task:: { Context , Poll } ;
70+ use core:: task:: { Context , Poll , Executor , SpawnErrorKind , SpawnObjError } ;
7171
7272use raw_vec:: RawVec ;
7373use str:: from_boxed_utf8_unchecked;
@@ -972,6 +972,19 @@ unsafe impl<'a, T, F> UnsafeFutureObj<'a, T> for PinBox<F>
972972 }
973973}
974974
975+ #[ unstable( feature = "futures_api" , issue = "50547" ) ]
976+ impl < E > Executor for Box < E >
977+ where E : Executor + ?Sized
978+ {
979+ fn spawn_obj ( & mut self , task : FutureObj < ' static , ( ) > ) -> Result < ( ) , SpawnObjError > {
980+ ( * * self ) . spawn_obj ( task)
981+ }
982+
983+ fn status ( & self ) -> Result < ( ) , SpawnErrorKind > {
984+ ( * * self ) . status ( )
985+ }
986+ }
987+
975988#[ unstable( feature = "futures_api" , issue = "50547" ) ]
976989impl < ' a , F : Future < Output = ( ) > + Send + ' a > From < PinBox < F > > for FutureObj < ' a , ( ) > {
977990 fn from ( boxed : PinBox < F > ) -> Self {
0 commit comments