diff --git a/hyper/src/server/conn.rs b/hyper/src/server/conn.rs index af79923..4b91c3c 100644 --- a/hyper/src/server/conn.rs +++ b/hyper/src/server/conn.rs @@ -170,10 +170,8 @@ mod upgrades { #[must_use = "futures do nothing unless polled"] #[allow(missing_debug_implementations)] pub struct UpgradeableConnection - where - S: HttpService, { - pub(super) inner: Connection, + pub(super) inner: (T, S, E), } impl UpgradeableConnection where diff --git a/hyper/src/server/server.rs b/hyper/src/server/server.rs index 4917e81..749e720 100644 --- a/hyper/src/server/server.rs +++ b/hyper/src/server/server.rs @@ -21,15 +21,21 @@ pin_project! { " `Server` is a `Future` mapping a bound listener with a set of service"] #[doc = " handlers. It is built using the [`Builder`](Builder), and the future"] #[doc = " completes when the server has been shutdown. It should be run by an"] #[doc = - " `Executor`."] pub struct Server < I, S, E = Exec > { #[pin] incoming : I, - make_service : S, protocol : Http_ < E >, } + " `Executor`."] + + pub struct Server < I, S, E = Exec > { + + #[pin] incoming : I, + make_service : S, + protocol : Http_ < E >, + } } /// A builder for a [`Server`](Server). #[derive(Debug)] #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] pub struct Builder { incoming: I, - protocol: Http_, + protocol: E, } #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))] impl Server { @@ -50,7 +56,7 @@ impl Server { /// /// This method will panic if binding to the address fails. For a method /// to bind to an address and return a `Result`, see `Server::try_bind`. - pub fn bind(addr: &SocketAddr) -> Builder { + pub fn bind() -> Builder { loop {} } } @@ -161,15 +167,14 @@ impl Builder { pub fn serve(self, _: S) -> Server where I: Accept, - I::Error: Into>, S: MakeServiceRef, { loop {} } } -pub trait Watcher, E>: Clone { - type Future: Future>; - fn watch(&self, conn: UpgradeableConnection) -> Self::Future; +pub trait Watcher: Clone { + type Future; + fn watch(&self) -> Self::Future; } #[allow(missing_debug_implementations)] #[derive(Copy, Clone)] @@ -183,7 +188,7 @@ where ::Error: Into>, { type Future = UpgradeableConnection; - fn watch(&self, conn: UpgradeableConnection) -> Self::Future { + fn watch(&self) -> Self::Future { loop {} } } @@ -197,14 +202,26 @@ pub(crate) mod new_svc { use crate::service::HttpService; use pin_project_lite::pin_project; pin_project! { - #[allow(missing_debug_implementations)] pub struct NewSvcTask < I, N, S : - HttpService < Body >, E, W : Watcher < I, S, E >> { #[pin] state : State < I, N, - S, E, W >, } + #[allow(missing_debug_implementations)] + + pub struct NewSvcTask < I, N, S : HttpService < Body >, E, W : Watcher < I, S, E >> { + + #[pin] + state : State , + + a: (N) + + } } pin_project! { - #[project = StateProj] pub (super) enum State < I, N, S : HttpService < Body >, - E, W : Watcher < I, S, E >> { Connecting { #[pin] connecting : Connecting < I, N, - E >, watcher : W, }, Connected { #[pin] future : W::Future, }, } + #[project = StateProj] + + pub (super) enum State , E, W : Watcher < I, S, E >> { + + Connecting { a: (I, S, W, E), }, + + Connected { #[pin] future : W::Future, }, + } } impl, E, W: Watcher> NewSvcTask { pub(super) fn new(connecting: Connecting, watcher: W) -> Self { diff --git a/hyper/src/server/shutdown.rs b/hyper/src/server/shutdown.rs index 307a452..8bb658c 100644 --- a/hyper/src/server/shutdown.rs +++ b/hyper/src/server/shutdown.rs @@ -52,7 +52,7 @@ where UpgradeableConnection, fn(Pin<&mut UpgradeableConnection>), >; - fn watch(&self, conn: UpgradeableConnection) -> Self::Future { + fn watch(&self) -> Self::Future { loop {} } } diff --git a/src/main.rs b/src/main.rs index 12d5273..4094f3d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,5 @@ fn main() { .with(warp::trace::request()), ); let make_svc = make_service_fn(move |_| future::ok::<_, Infallible>(svc.clone())); - let addr = SocketAddr::from(([127, 0, 0, 1], 0)); - tokio::spawn(hyper::Server::bind(&addr).serve(make_svc)); + tokio::spawn(hyper::Server::bind().serve(make_svc)); }