feat(transport): Add Router::into_service
#419
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.
Motivation
Coincidentally I was going to open an issue for this after spending some time on my own trying to accomplish this, but #410 was on the first page.
I wanted to help merge #272 since it appeared to be slightly stalled. I have a need for the functionality of running an HTTP server and a gRPC server with multiple services on the same port.
Solution
The major work appeared to be complete and was appeared to be an acceptable implementation. The finishing code was actually provided in #272 (comment) so I just barely provided work. It was a successful group effort overall.
I rebased the PR branch w/ respect to the original author @cthulhua (with a minor change the import of
futures_util::Future::Either
) and moved theservice
function into the Router impl as per the original feedback.Testing
Additionally, I added a new example
hyper_warp_multiplex
, a mix of thehyper_warp
andmultiplex
examples.cargo run --bin hyper-warp-multiplex-server
cargo run --bin hyper-warp-multiplex-client