Skip to content

Commit c7584e6

Browse files
committed
Implement Clone for RouterIntoService
1 parent 3fda093 commit c7584e6

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
@@ -10,10 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- **added:** `Body` implements `From<()>` now ([#2411])
1111
- **change:** Update version of multer used internally for multipart ([#2433])
1212
- **change:** Update tokio-tungstenite to 0.21 ([#2435])
13+
- **added:** `RouterIntoService` implements `Clone` ([#2456])
1314

1415
[#2411]: https://github.com/tokio-rs/axum/pull/2411
1516
[#2433]: https://github.com/tokio-rs/axum/pull/2433
1617
[#2435]: https://github.com/tokio-rs/axum/pull/2435
18+
[#2456]: https://github.com/tokio-rs/axum/pull/2456
1719

1820
# 0.7.2 (03. December, 2023)
1921

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)