Skip to content

Commit

Permalink
Implement Clone for RouterIntoService
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanburgers committed Dec 29, 2023
1 parent 560213a commit 2011f67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions axum/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **change:** Update tokio-tungstenite to 0.21 ([#2435])
- **added:** Enable `tracing` feature by default ([#2460])
- **added:** Support graceful shutdown on `serve` ([#2398])
- **added:** `RouterIntoService` implements `Clone` ([#2456])

[#2411]: https://github.com/tokio-rs/axum/pull/2411
[#2433]: https://github.com/tokio-rs/axum/pull/2433
[#2435]: https://github.com/tokio-rs/axum/pull/2435
[#2460]: https://github.com/tokio-rs/axum/pull/2460
[#2398]: https://github.com/tokio-rs/axum/pull/2398
[#2456]: https://github.com/tokio-rs/axum/pull/2456

# 0.7.2 (03. December, 2023)

Expand Down
12 changes: 12 additions & 0 deletions axum/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ pub struct RouterIntoService<B, S = ()> {
_marker: PhantomData<B>,
}

impl<B, S> Clone for RouterIntoService<B, S>
where
Router<S>: Clone,
{
fn clone(&self) -> Self {
Self {
router: self.router.clone(),
_marker: PhantomData,
}
}
}

impl<B> Service<Request<B>> for RouterIntoService<B, ()>
where
B: HttpBody<Data = bytes::Bytes> + Send + 'static,
Expand Down

0 comments on commit 2011f67

Please sign in to comment.