Skip to content

Commit b494d45

Browse files
authored
Implement Clone for RouterIntoService (#2456)
1 parent 560213a commit b494d45

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

axum/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- **change:** Update tokio-tungstenite to 0.21 ([#2435])
1313
- **added:** Enable `tracing` feature by default ([#2460])
1414
- **added:** Support graceful shutdown on `serve` ([#2398])
15+
- **added:** `RouterIntoService` implements `Clone` ([#2456])
1516

1617
[#2411]: https://github.com/tokio-rs/axum/pull/2411
1718
[#2433]: https://github.com/tokio-rs/axum/pull/2433
1819
[#2435]: https://github.com/tokio-rs/axum/pull/2435
1920
[#2460]: https://github.com/tokio-rs/axum/pull/2460
2021
[#2398]: https://github.com/tokio-rs/axum/pull/2398
22+
[#2456]: https://github.com/tokio-rs/axum/pull/2456
2123

2224
# 0.7.2 (03. December, 2023)
2325

axum/src/routing/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,18 @@ pub struct RouterIntoService<B, S = ()> {
515515
_marker: PhantomData<B>,
516516
}
517517

518+
impl<B, S> Clone for RouterIntoService<B, S>
519+
where
520+
Router<S>: Clone,
521+
{
522+
fn clone(&self) -> Self {
523+
Self {
524+
router: self.router.clone(),
525+
_marker: PhantomData,
526+
}
527+
}
528+
}
529+
518530
impl<B> Service<Request<B>> for RouterIntoService<B, ()>
519531
where
520532
B: HttpBody<Data = bytes::Bytes> + Send + 'static,

0 commit comments

Comments
 (0)