mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-01 08:56:15 +01:00
Allow Error: Into<Infallible>
for Route::{layer, route_layer}
(#948)
* Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}` (#924) * Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}` Fixes https://github.com/tokio-rs/axum/issues/922 * changelog * fixup changelog
This commit is contained in:
parent
56ddabcd7d
commit
661473dcbc
2 changed files with 12 additions and 8 deletions
|
@ -30,14 +30,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
extractor ([#1078])
|
||||
- **added:** Implement `IntoResponse` for `Form` ([#1095])
|
||||
- **change:** axum's MSRV is now 1.56 ([#1098])
|
||||
- **breaking:** Remove `extractor_middleware` which was previously deprecated.
|
||||
Use `axum::middleware::from_extractor` instead ([#1077])
|
||||
- **breaking:** Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}` ([#924])
|
||||
- **breaking:** Remove `extractor_middleware` which was previously deprecated.
|
||||
Use `axum::middleware::from_extractor` instead ([#1077])
|
||||
|
||||
[#1077]: https://github.com/tokio-rs/axum/pull/1077
|
||||
[#1078]: https://github.com/tokio-rs/axum/pull/1078
|
||||
[#1078]: https://github.com/tokio-rs/axum/pull/1078
|
||||
[#1078]: https://github.com/tokio-rs/axum/pull/1078
|
||||
[#1095]: https://github.com/tokio-rs/axum/pull/1095
|
||||
[#1098]: https://github.com/tokio-rs/axum/pull/1098
|
||||
[#924]: https://github.com/tokio-rs/axum/pull/924
|
||||
|
||||
# 0.5.7 (08. June, 2022)
|
||||
|
||||
|
|
|
@ -294,15 +294,15 @@ where
|
|||
pub fn layer<L, NewReqBody, NewResBody>(self, layer: L) -> Router<NewReqBody>
|
||||
where
|
||||
L: Layer<Route<B>>,
|
||||
L::Service: Service<Request<NewReqBody>, Response = Response<NewResBody>, Error = Infallible>
|
||||
+ Clone
|
||||
+ Send
|
||||
+ 'static,
|
||||
L::Service:
|
||||
Service<Request<NewReqBody>, Response = Response<NewResBody>> + Clone + Send + 'static,
|
||||
<L::Service as Service<Request<NewReqBody>>>::Error: Into<Infallible> + 'static,
|
||||
<L::Service as Service<Request<NewReqBody>>>::Future: Send + 'static,
|
||||
NewResBody: HttpBody<Data = Bytes> + Send + 'static,
|
||||
NewResBody::Error: Into<BoxError>,
|
||||
{
|
||||
let layer = ServiceBuilder::new()
|
||||
.map_err(Into::into)
|
||||
.layer(MapResponseBodyLayer::new(boxed))
|
||||
.layer(layer)
|
||||
.into_inner();
|
||||
|
@ -335,15 +335,14 @@ where
|
|||
pub fn route_layer<L, NewResBody>(self, layer: L) -> Self
|
||||
where
|
||||
L: Layer<Route<B>>,
|
||||
L::Service: Service<Request<B>, Response = Response<NewResBody>, Error = Infallible>
|
||||
+ Clone
|
||||
+ Send
|
||||
+ 'static,
|
||||
L::Service: Service<Request<B>, Response = Response<NewResBody>> + Clone + Send + 'static,
|
||||
<L::Service as Service<Request<B>>>::Error: Into<Infallible> + 'static,
|
||||
<L::Service as Service<Request<B>>>::Future: Send + 'static,
|
||||
NewResBody: HttpBody<Data = Bytes> + Send + 'static,
|
||||
NewResBody::Error: Into<BoxError>,
|
||||
{
|
||||
let layer = ServiceBuilder::new()
|
||||
.map_err(Into::into)
|
||||
.layer(MapResponseBodyLayer::new(boxed))
|
||||
.layer(layer)
|
||||
.into_inner();
|
||||
|
|
Loading…
Reference in a new issue