mirror of
https://github.com/tokio-rs/axum.git
synced 2025-02-17 02:34:28 +01:00
Implement Clone
and Service
for Next
(#1712)
This commit is contained in:
parent
6d815e2b0a
commit
7a52161826
2 changed files with 24 additions and 0 deletions
|
@ -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])
|
||||
- **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
|
||||
[#1693]: https://github.com/tokio-rs/axum/pull/1693
|
||||
[#1712]: https://github.com/tokio-rs/axum/pull/1712
|
||||
|
||||
# 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`].
|
||||
pub struct ResponseFuture {
|
||||
inner: BoxFuture<'static, Response>,
|
||||
|
|
Loading…
Add table
Reference in a new issue