Introduce Response type alias as a shorthand for Response<BoxBody> (#590)

* Introduce `Response` type alias as a shorthand

* Don't re-export `Response` at the crate root
This commit is contained in:
Kai Jewson
2021-12-05 19:16:46 +01:00
committed by GitHub
parent cbb34869d8
commit dfb06e721c
41 changed files with 210 additions and 237 deletions
+5 -7
View File
@@ -1,12 +1,10 @@
use axum::{
async_trait,
body::BoxBody,
extract::{
rejection::{ExtensionRejection, ExtensionsAlreadyExtracted},
Extension, FromRequest, RequestParts,
},
http::Response,
response::IntoResponse,
response::{IntoResponse, Response},
};
use std::{
fmt,
@@ -31,8 +29,8 @@ use std::{
/// async_trait,
/// extract::{FromRequest, RequestParts},
/// body::BoxBody,
/// response::IntoResponse,
/// http::{StatusCode, Response},
/// response::{IntoResponse, Response},
/// http::StatusCode,
/// };
///
/// #[derive(Clone)]
@@ -58,7 +56,7 @@ use std::{
/// where
/// B: Send,
/// {
/// type Rejection = Response<BoxBody>;
/// type Rejection = Response;
///
/// async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
/// // loading a `CurrentUser` requires first loading the `Session`
@@ -157,7 +155,7 @@ impl<R> IntoResponse for CachedRejection<R>
where
R: IntoResponse,
{
fn into_response(self) -> Response<BoxBody> {
fn into_response(self) -> Response {
match self {
Self::ExtensionsAlreadyExtracted(inner) => inner.into_response(),
Self::Inner(inner) => inner.into_response(),