1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::{Endpoint, IntoResponse, Request, Response};
/// Endpoint for the [`map_to_response`](super::EndpointExt::map_to_response)
/// method.
pub struct MapToResponse<E> {
inner: E,
}
impl<E> MapToResponse<E> {
#[inline]
pub(crate) fn new(inner: E) -> MapToResponse<E> {
Self { inner }
}
}
#[async_trait::async_trait]
impl<E: Endpoint> Endpoint for MapToResponse<E> {
type Output = Response;
async fn call(&self, req: Request) -> Self::Output {
self.inner.call(req).await.into_response()
}
}