[−][src]Trait futures::compat::Executor01CompatExt
pub trait Executor01CompatExt: 'static + Send + Clone + Executor<Compat<UnitError<FutureObj<'static, ()>>, Box<Spawn + 'static + Send>>> { fn compat(self) -> Executor01As03<Self>; }
Extension trait for futures 0.1 Executor
.
Required Methods
fn compat(self) -> Executor01As03<Self>
Converts a futures 0.1 Executor
into a
futures 0.3 Spawn
.
#![feature(async_await, await_macro, futures_api)] use futures01::Future; use futures::future::{FutureExt, TryFutureExt}; use futures::compat::Executor01CompatExt; use futures::spawn; use tokio_threadpool::ThreadPool; let pool01 = ThreadPool::new(); let spawner03 = pool01.sender().clone().compat(); let future03 = async { println!("Running on the pool"); spawn!(async { println!("Spawned!"); }).unwrap(); }; let future01 = future03.unit_error().boxed().compat(spawner03); pool01.spawn(future01); pool01.shutdown_on_idle().wait().unwrap();