Skip to content

Commit 6c250dd

Browse files
committed
conduit-axum: Extract ConduitAxumHandler::wrap() fn
1 parent 4fd7a0e commit 6c250dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

conduit-axum/src/fallback.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ pub trait ConduitFallback {
3131

3232
impl ConduitFallback for axum::Router {
3333
fn conduit_fallback(self, handler: impl Handler) -> Self {
34-
self.fallback(ConduitAxumHandler(Arc::new(handler)))
34+
self.fallback(ConduitAxumHandler::wrap(handler))
3535
}
3636
}
3737

3838
#[derive(Debug)]
3939
pub struct ConduitAxumHandler<H>(pub Arc<H>);
4040

41+
impl<H> ConduitAxumHandler<H> {
42+
pub fn wrap(handler: H) -> Self {
43+
Self(Arc::new(handler))
44+
}
45+
}
46+
4147
impl<H> Clone for ConduitAxumHandler<H> {
4248
fn clone(&self) -> Self {
4349
Self(self.0.clone())

0 commit comments

Comments
 (0)