21 lines
480 B
Rust
21 lines
480 B
Rust
|
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())
|
||
|
)
|
||
|
)
|
||
|
;
|
||
|
|
||
|
core.run(f).unwrap();
|
||
|
}
|