extern crate futures; extern crate tokio_core; use futures::future::{self}; use futures::future::*; use tokio_core::reactor::Core; fn main() { let mut core = Core::new().expect("Failed to initialize tokio_core reactor!"); let f = future::result::<(),()>(Ok(())) .map_err(|_| "&'static str error") .and_then(|_| future::result(Ok(()) .map_err(|()| "String error".to_owned()) ) ) .and_then(|_| future::result::<(), String>(Err("another &'static str error".to_owned()))) ; core.run(f).unwrap(); }