Skip to content

Commit

Permalink
feat(router): Implement From Routes and axum::Router for RoutesBuilder (
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Sep 27, 2024
1 parent 1470dfb commit e8da1a3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tonic/src/service/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ impl Routes {
}
}

impl From<Routes> for RoutesBuilder {
fn from(routes: Routes) -> Self {
Self {
routes: Some(routes),
}
}
}

impl From<axum::Router> for RoutesBuilder {
fn from(router: axum::Router) -> Self {
Self {
routes: Some(router.into()),
}
}
}

impl From<axum::Router> for Routes {
fn from(router: axum::Router) -> Self {
Self { router }
Expand Down

0 comments on commit e8da1a3

Please sign in to comment.