mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Implement Clone and Service for Next (#1712)
This commit is contained in:
@@ -9,9 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- **added:** Implement `IntoResponse` for `&'static [u8; N]` and `[u8; N]` ([#1690])
|
- **added:** Implement `IntoResponse` for `&'static [u8; N]` and `[u8; N]` ([#1690])
|
||||||
- **fixed:** Make `Path` support types uses `serde::Deserializer::deserialize_any` ([#1693])
|
- **fixed:** Make `Path` support types uses `serde::Deserializer::deserialize_any` ([#1693])
|
||||||
|
- **added:** Implement `Clone` and `Service` for `axum::middleware::Next` ([#1712])
|
||||||
|
|
||||||
[#1690]: https://github.com/tokio-rs/axum/pull/1690
|
[#1690]: https://github.com/tokio-rs/axum/pull/1690
|
||||||
[#1693]: https://github.com/tokio-rs/axum/pull/1693
|
[#1693]: https://github.com/tokio-rs/axum/pull/1693
|
||||||
|
[#1712]: https://github.com/tokio-rs/axum/pull/1712
|
||||||
|
|
||||||
# 0.6.2 (9. January, 2023)
|
# 0.6.2 (9. January, 2023)
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,28 @@ impl<B> fmt::Debug for Next<B> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<B> Clone for Next<B> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
inner: self.inner.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<B> Service<Request<B>> for Next<B> {
|
||||||
|
type Response = Response;
|
||||||
|
type Error = Infallible;
|
||||||
|
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
|
||||||
|
|
||||||
|
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
|
self.inner.poll_ready(cx)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn call(&mut self, req: Request<B>) -> Self::Future {
|
||||||
|
self.inner.call(req)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Response future for [`FromFn`].
|
/// Response future for [`FromFn`].
|
||||||
pub struct ResponseFuture {
|
pub struct ResponseFuture {
|
||||||
inner: BoxFuture<'static, Response>,
|
inner: BoxFuture<'static, Response>,
|
||||||
|
|||||||
Reference in New Issue
Block a user