Skip to content

Instantly share code, notes, and snippets.

@manuels
Created May 15, 2018 19:27
Show Gist options
  • Save manuels/d6a7d33f3a566a62c33cbd77bdf309a8 to your computer and use it in GitHub Desktop.
Save manuels/d6a7d33f3a566a62c33cbd77bdf309a8 to your computer and use it in GitHub Desktop.
#![feature(proc_macro, generators, pin)]
pub extern crate std as stdx;
pub extern crate futures_async_runtime;
extern crate tokio;
extern crate futures as futures1;
extern crate futures_core;
extern crate futures_compat;
extern crate futures_executor;
extern crate futures_macro_async;
#[macro_use] extern crate futures_macro_await;
use futures1::Future as Future1;
use futures_macro_async::async;
use futures_executor::ThreadPool;
use futures_async_runtime::StableFuture;
use futures_compat::futures_02::FutureInto01;
pub mod futures {
pub mod __rt {
pub use futures_async_runtime::{*};
pub use stdx as std;
}
}
#[async]
fn foo() -> Result<(),()> {
await!(futures_core::future::ok::<(),()>(()))?;
Ok(())
}
fn main() {
let futv02 = foo().pin();
let exec = ThreadPool::new().expect("Failed to create threadpool");
let futv01 = futv02.into_01_compat(exec)
.map(|val| {
println!("map from v0.1! {:?}", val);
});
tokio::run(futv01);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment