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:
		
							
								
								
									
										11
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/lib.rs
									
									
									
									
									
								
							| @@ -18,18 +18,20 @@ | ||||
|  | ||||
| extern crate bytes; | ||||
| #[macro_use] extern crate futures; | ||||
| extern crate futures_cpupool; | ||||
| #[cfg(feature = "runtime")] extern crate futures_cpupool; | ||||
| extern crate futures_timer; | ||||
| extern crate h2; | ||||
| extern crate http; | ||||
| extern crate httparse; | ||||
| extern crate iovec; | ||||
| #[macro_use] extern crate log; | ||||
| extern crate net2; | ||||
| #[cfg(feature = "runtime")] extern crate net2; | ||||
| extern crate time; | ||||
| extern crate tokio; | ||||
| extern crate tokio_executor; | ||||
| #[cfg(feature = "runtime")] extern crate tokio; | ||||
| #[cfg(feature = "runtime")] extern crate tokio_executor; | ||||
| #[macro_use] extern crate tokio_io; | ||||
| #[cfg(feature = "runtime")] extern crate tokio_reactor; | ||||
| #[cfg(feature = "runtime")] extern crate tokio_tcp; | ||||
| extern crate want; | ||||
|  | ||||
| #[cfg(all(test, feature = "nightly"))] | ||||
| @@ -62,3 +64,4 @@ mod headers; | ||||
| mod proto; | ||||
| pub mod server; | ||||
| pub mod service; | ||||
| #[cfg(feature = "runtime")] pub mod rt; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user