mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 08:41:36 +00:00
refactor(core)!: remove EitherOutput
(#3341)
The trick with this one is to use `futures::Either` everywhere where we may wrap something that implements any of the `futures` traits. This includes the output of `EitherFuture` itself. We also need to implement `StreamMuxer` on `future::Either` because `StreamMuxer`s may be the the `Output` of `InboundUpgrade`.
This commit is contained in:
@ -19,10 +19,11 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
use crate::{
|
||||
either::{EitherFuture, EitherName, EitherOutput},
|
||||
either::{EitherFuture, EitherName},
|
||||
upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo},
|
||||
};
|
||||
use either::Either;
|
||||
use futures::future;
|
||||
|
||||
impl<A, B> UpgradeInfo for Either<A, B>
|
||||
where
|
||||
@ -48,7 +49,7 @@ where
|
||||
A: InboundUpgrade<C, Output = TA, Error = EA>,
|
||||
B: InboundUpgrade<C, Output = TB, Error = EB>,
|
||||
{
|
||||
type Output = EitherOutput<TA, TB>;
|
||||
type Output = future::Either<TA, TB>;
|
||||
type Error = Either<EA, EB>;
|
||||
type Future = EitherFuture<A::Future, B::Future>;
|
||||
|
||||
@ -70,7 +71,7 @@ where
|
||||
A: OutboundUpgrade<C, Output = TA, Error = EA>,
|
||||
B: OutboundUpgrade<C, Output = TB, Error = EB>,
|
||||
{
|
||||
type Output = EitherOutput<TA, TB>;
|
||||
type Output = future::Either<TA, TB>;
|
||||
type Error = Either<EA, EB>;
|
||||
type Future = EitherFuture<A::Future, B::Future>;
|
||||
|
||||
|
Reference in New Issue
Block a user