[][src]Trait futures_util::compat::Executor01CompatExt

pub trait Executor01CompatExt: Executor01<Executor01Future> + Clone + Send + 'static {
    fn compat(self) -> Executor01As03<Self>
    where
        Self: Sized
; }

Extension trait for futures 0.1 Executor.

Required methods

fn compat(self) -> Executor01As03<Self> where
    Self: Sized

Converts a futures 0.1 Executor into a futures 0.3 Spawn.

This example is not tested
#![feature(async_await, await_macro, futures_api)]
use futures::Future;
use futures::future::{FutureExt, TryFutureExt};
use futures::compat::Executor01CompatExt;
use futures::spawn;
use tokio_threadpool::ThreadPool;

let pool01 = ThreadPool::new();

let future03 = async {
    println!("Running on the pool");
    spawn!(async {
        println!("Spawned!");
    }).unwrap();
};

let future01 = future03.unit_error().boxed().compat();

pool01.spawn(future01);
pool01.shutdown_on_idle().wait().unwrap();
Loading content...

Implementors

impl<Ex> Executor01CompatExt for Ex where
    Ex: Executor01<Executor01Future> + Clone + Send + 'static, 
[src]

Loading content...