use crate::hyper::Response;
use crate::{error::BoxError, IntoResponse};
use std::{future::Future, pin::Pin};
pub type ResponseFuture =
Pin<Box<dyn Future<Output = Result<Response<String>, BoxError>> + Send + Sync + 'static>>;
pub trait IntoResponseFuture {
fn into_response_future(self) -> ResponseFuture;
}
impl<F> IntoResponseFuture for F
where
F: Future + Send + Sync + 'static,
F::Output: IntoResponse,
{
fn into_response_future(self) -> ResponseFuture {
Box::pin(async { self.await.into_response() })
}
}