use std::error::Error as StdError; use pin_project_lite::pin_project; use tokio::io::{AsyncRead, AsyncWrite}; use tracing::debug; use super::accept::Accept; use super::conn::UpgradeableConnection; use super::server::{Server, Watcher}; use crate::body::{Body, HttpBody}; use crate::common::drain::{self, Draining, Signal, Watch, Watching}; use crate::common::exec::{ConnStreamExec, NewSvcExec}; use crate::common::{task, Future, Pin, Poll, Unpin}; use crate::service::{HttpService, MakeServiceRef}; pin_project! { #[allow(missing_debug_implementations)] pub struct Graceful < I, S, F, E > { #[pin] state : State < I, S, F, E >, } } pin_project! { #[project = StateProj] pub (super) enum State < I, S, F, E > { Running { drain : Option < (Signal, Watch) >, #[pin] server : Server < I, S, E >, #[pin] signal : F, }, Draining { draining : Draining }, } } impl Graceful { pub(super) fn new(server: Server, signal: F) -> Self { loop {} } } impl Future for Graceful where I: Accept, IE: Into>, IO: AsyncRead + AsyncWrite + Unpin + Send + 'static, S: MakeServiceRef, S::Error: Into>, B: HttpBody + 'static, B::Error: Into>, F: Future, E: ConnStreamExec<>::Future, B>, E: NewSvcExec, { type Output = crate::Result<()>; fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll { loop {} } } #[allow(missing_debug_implementations)] #[derive(Clone)] pub struct GracefulWatcher(Watch); impl Watcher for GracefulWatcher where I: AsyncRead + AsyncWrite + Unpin + Send + 'static, S: HttpService, E: ConnStreamExec, S::ResBody: 'static, ::Error: Into>, { type Future = Watching< UpgradeableConnection, fn(Pin<&mut UpgradeableConnection>), >; fn watch(&self, conn: UpgradeableConnection) -> Self::Future { loop {} } } fn on_drain(conn: Pin<&mut UpgradeableConnection>) where S: HttpService, S::Error: Into>, I: AsyncRead + AsyncWrite + Unpin, S::ResBody: HttpBody + 'static, ::Error: Into>, E: ConnStreamExec, { loop {} }