mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-25 00:00:23 +02:00
Quality of life improvements
This commit is contained in:
+1
-17
@@ -5,17 +5,9 @@ use serde::Serialize;
|
||||
use std::convert::Infallible;
|
||||
use tower::util::Either;
|
||||
|
||||
// TODO(david): can we change this to not be generic over the body and just use hyper::Body?
|
||||
pub trait IntoResponse<B> {
|
||||
fn into_response(self) -> Response<B>;
|
||||
|
||||
// TODO(david): remove this an return return `Response<B>` instead. That is what this method
|
||||
// does anyway.
|
||||
fn boxed(self) -> BoxIntoResponse<B>
|
||||
where
|
||||
Self: Sized + 'static,
|
||||
{
|
||||
BoxIntoResponse(self.into_response())
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> IntoResponse<B> for ()
|
||||
@@ -171,14 +163,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BoxIntoResponse<B>(Response<B>);
|
||||
|
||||
impl<B> IntoResponse<B> for BoxIntoResponse<B> {
|
||||
fn into_response(self) -> Response<B> {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> IntoResponse<B> for StatusCode
|
||||
where
|
||||
B: Default,
|
||||
|
||||
Reference in New Issue
Block a user