
Either
(#637)
In practice I've found `Either` be hard to use since it changes the error type to `BoxError`. That means if you combine two infallible services you get a service that, to the type system, is fallible. That doesn't work well with [axum's error handling](https://docs.rs/axum/latest/axum/error_handling/index.html) model which requires all services to be infallible and thus always return a response. So you end up having to add boilerplate just to please the type system. Additionally, the fact that `Either` implements `Future` also means we cannot fully remove the dependency on `pin-project` since `pin-project-lite` doesn't support tuple enum variants, only named fields. This PR reworks `Either` to address these: - It now requires the two services to have the same error type so no type information is lost. I did consider doing something like `where B::Error: From<A::Error>` but I hope this simpler model will lead to better compiler errors. - Changes the response future to be a struct with a private enum using `pin-project-lite` - Removes the `Future` impl so we can remove the dependency on `pin-project` Goes without saying that this is a breaking change so we have to wait until tower 0.5 to ship this. cc @jplatte Fixes #594 Fixes #550
Tower
Tower is a library of modular and reusable components for building robust networking clients and servers.
Overview
Tower aims to make it as easy as possible to build robust networking clients and servers. It is protocol agnostic, but is designed around a request / response pattern. If your protocol is entirely stream based, Tower may not be a good fit.
Supported Rust Versions
Tower will keep a rolling MSRV (minimum supported Rust version) policy of at least 6 months. When increasing the MSRV, the new Rust version must have been released at least six months ago. The current MSRV is 1.49.0.
Getting Started
If you're brand new to Tower and want to start with the basics we recommend you check out some of our guides.
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tower by you, shall be licensed as MIT, without any additional terms or conditions.