feat(rt): make tokio runtime optional
A Cargo feature `runtime` is added, which is enabled by default, that includes the following: - The `client::HttpConnector`, which uses `tokio::net::TcpStream`. - The `server::AddrStream`, which uses `tokio::net::TcpListener`. - The `hyper::rt` module, which includes useful utilities to work with the runtime without needing to import `futures` or `tokio` explicity. Disabling the feature removes many of these niceties, but allows people to use hyper in environments that have an alternative runtime, without needing to download an unused one.
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
#![deny(warnings)]
|
||||
extern crate hyper;
|
||||
extern crate futures;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate tokio;
|
||||
|
||||
use futures::Future;
|
||||
|
||||
use hyper::{Body, Response, Server};
|
||||
use hyper::service::service_fn_ok;
|
||||
use hyper::rt::{self, Future};
|
||||
|
||||
static PHRASE: &'static [u8] = b"Hello World!";
|
||||
|
||||
@@ -33,5 +30,5 @@ fn main() {
|
||||
|
||||
println!("Listening on http://{}", addr);
|
||||
|
||||
tokio::run(server);
|
||||
rt::run(server);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user