Remove tower from axum's public API (#229)

Instead rely on `tower-service` and `tower-layer`. `tower` itself is
only used internally.

Fixes https://github.com/tokio-rs/axum/issues/186
This commit is contained in:
David Pedersen
2021-08-21 15:01:30 +02:00
committed by GitHub
parent 35ea7ca0ff
commit f8a0d81d79
27 changed files with 102 additions and 50 deletions
+1 -18
View File
@@ -2,7 +2,7 @@
use crate::{
body::{box_body, BoxBody},
Error,
BoxError, Error,
};
use bytes::Bytes;
use http::{header, HeaderMap, HeaderValue, Response, StatusCode};
@@ -11,7 +11,6 @@ use http_body::{
Empty, Full,
};
use std::{borrow::Cow, convert::Infallible};
use tower::{util::Either, BoxError};
mod headers;
mod redirect;
@@ -154,22 +153,6 @@ impl IntoResponse for Infallible {
}
}
impl<T, K> IntoResponse for Either<T, K>
where
T: IntoResponse,
K: IntoResponse,
{
type Body = BoxBody;
type BodyError = Error;
fn into_response(self) -> Response<Self::Body> {
match self {
Either::A(inner) => inner.into_response().map(box_body),
Either::B(inner) => inner.into_response().map(box_body),
}
}
}
impl<T, E> IntoResponse for Result<T, E>
where
T: IntoResponse,