feat(lib): Export more things with Cargo features [server, !http1, !http2]
* server::Server
* server::conn::{AddrIncoming, AddrStream}
This allows higher-level libraries to use or re-export more parts of the
API without deciding for the end user which HTTP versions the hyper
server will support.
			
			
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							cf6f62c71e
						
					
				
				
					commit
					0a4b56acb8
				
			| @@ -3,14 +3,16 @@ use std::future::Future; | ||||
| use std::pin::Pin; | ||||
| use std::sync::Arc; | ||||
|  | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| use crate::body::Body; | ||||
| #[cfg(feature = "server")] | ||||
| use crate::body::{Body, HttpBody}; | ||||
| use crate::body::HttpBody; | ||||
| #[cfg(all(feature = "http2", feature = "server"))] | ||||
| use crate::proto::h2::server::H2Stream; | ||||
| use crate::rt::Executor; | ||||
| #[cfg(feature = "server")] | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| use crate::server::conn::spawn_all::{NewSvcTask, Watcher}; | ||||
| #[cfg(feature = "server")] | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| use crate::service::HttpService; | ||||
|  | ||||
| #[cfg(feature = "server")] | ||||
| @@ -18,7 +20,7 @@ pub trait ConnStreamExec<F, B: HttpBody>: Clone { | ||||
|     fn execute_h2stream(&mut self, fut: H2Stream<F, B>); | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "server")] | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| pub trait NewSvcExec<I, N, S: HttpService<Body>, E, W: Watcher<I, S, E>>: Clone { | ||||
|     fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>); | ||||
| } | ||||
| @@ -76,7 +78,7 @@ where | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "server")] | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for Exec | ||||
| where | ||||
|     NewSvcTask<I, N, S, E, W>: Future<Output = ()> + Send + 'static, | ||||
| @@ -102,7 +104,7 @@ where | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "server")] | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for E | ||||
| where | ||||
|     E: Executor<NewSvcTask<I, N, S, E, W>> + Clone, | ||||
|   | ||||
| @@ -12,7 +12,7 @@ pub(crate) mod buf; | ||||
| pub(crate) mod date; | ||||
| #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] | ||||
| pub(crate) mod drain; | ||||
| #[cfg(any(feature = "http1", feature = "http2"))] | ||||
| #[cfg(any(feature = "http1", feature = "http2", feature = "server"))] | ||||
| pub(crate) mod exec; | ||||
| pub(crate) mod io; | ||||
| #[cfg(all(feature = "client", any(feature = "http1", feature = "http2")))] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user