refactor(lib): convert to futures 0.2.0-beta (#1470)
This commit is contained in:
@@ -4,7 +4,7 @@ extern crate futures;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate tokio;
|
||||
|
||||
use futures::Future;
|
||||
use futures::FutureExt;
|
||||
use futures::future::lazy;
|
||||
|
||||
use hyper::{Body, Response};
|
||||
@@ -20,13 +20,13 @@ fn main() {
|
||||
Ok(Response::new(Body::from(PHRASE)))
|
||||
}));
|
||||
|
||||
tokio::run(lazy(move || {
|
||||
tokio::runtime::run2(lazy(move |_| {
|
||||
let server = Http::new()
|
||||
.sleep_on_errors(true)
|
||||
.bind(&addr, new_service)
|
||||
.unwrap();
|
||||
|
||||
println!("Listening on http://{} with 1 thread.", server.local_addr().unwrap());
|
||||
server.run().map_err(|err| eprintln!("Server error {}", err))
|
||||
println!("Listening on http://{}", server.local_addr().unwrap());
|
||||
server.run().map_err(|err| panic!("Server error {}", err))
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user