Replace HasRoutes with Into<Router> #819
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think
HasRoutes
in axum-extra is pretty neat. It allows users to build their own abstractions for building routes and have them work directly with axum. I've been thinking that for 0.5 we should promote the trait to live in axum.This is partly driven by some talks @LucioFranco and I have been having about possibly moving tonic's routing to axum in a more public way. Tonic currently reinvents a bunch of middleware stuff that axum already handles. That'd also give users more flexibility in how they compose their gRPC services. Such a change could have tonic implement
HasRoutes
for its services so they'd work withaxum::Router::merge
. However there are no concrete plans so its mostly speculation on my part.I don't see much downside to this.
Router
implementsHasRoutes
so everything works like it used to.@jplatte what do you think?