mock_http_connector/response/
future.rs1use crate::hyper::Response;
2use crate::{error::BoxError, IntoResponse};
3use std::{future::Future, pin::Pin};
4
5pub type ResponseFuture =
6 Pin<Box<dyn Future<Output = Result<Response<String>, BoxError>> + Send + Sync + 'static>>;
7
8pub trait IntoResponseFuture {
20 fn into_response_future(self) -> ResponseFuture;
22}
23
24impl<F> IntoResponseFuture for F
25where
26 F: Future + Send + Sync + 'static,
27 F::Output: IntoResponse,
28{
29 fn into_response_future(self) -> ResponseFuture {
30 Box::pin(async { self.await.into_response() })
31 }
32}