[][src]Trait futures::compat::Executor01CompatExt

pub trait Executor01CompatExt: 'static + Send + Clone + Executor<Compat<UnitError<FutureObj<'static, ()>>>> {
    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)]
use futures::Future;
use futures::task::SpawnExt;
use futures::future::{FutureExt, TryFutureExt};
use futures_util::compat::Executor01CompatExt;
use tokio::executor::DefaultExecutor;


let mut spawner = DefaultExecutor::current().compat();
let future03 = async move {
    println!("Running on the pool");
    spawner.spawn(async {
        println!("Spawned!");
    }).unwrap();
};

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

tokio::run(future01);
Loading content...

Implementors

impl<Ex> Executor01CompatExt for Ex where
    Ex: Executor<Compat<UnitError<FutureObj<'static, ()>>>> + Clone + Send + 'static, 
[src]

Loading content...