//! Handler future types. use crate::body::BoxBody; use http::{Request, Response}; use pin_project_lite::pin_project; use std::{ convert::Infallible, future::Future, pin::Pin, task::{Context, Poll}, }; use tower::Service; opaque_future! { /// The response future for [`IntoService`](super::IntoService). pub type IntoServiceFuture = futures_util::future::BoxFuture<'static, Result, Infallible>>; } pin_project! { /// The response future for [`OnMethod`](super::OnMethod). #[derive(Debug)] pub struct OnMethodFuture where S: Service>, F: Service> { #[pin] pub(super) inner: crate::routing::future::RouteFuture, } } impl Future for OnMethodFuture where S: Service, Response = Response>, F: Service, Response = Response, Error = S::Error>, { type Output = Result, S::Error>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { self.project().inner.poll(cx) } }