Fix mapping of upgrade. (#654)

The current implementation of `MapUpgrade` implements `InboundUpgrade`
and `OutboundUpgrade` and applies the transformation in both cases which
means that mapping is always applied to inbound and outbound upgrades.
This commit uses separate `MapInboundUpgrade` and `MapOutboundUpgrade`
types which implements both traits but only map in one direction.
This commit is contained in:
Toralf Wittner
2018-11-19 10:58:45 +01:00
committed by GitHub
parent 2c1807b646
commit 1d1970c772
3 changed files with 65 additions and 15 deletions

View File

@ -771,7 +771,7 @@ where
upgrade::OrUpgrade<
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapUpgrade<
upgrade::MapInboundUpgrade<
TProto1::InboundProtocol,
fn(TProto1Out) -> EitherOutput<TProto1Out, TProto2Out>
>,
@ -784,7 +784,7 @@ where
>,
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapUpgrade<
upgrade::MapInboundUpgrade<
TProto2::InboundProtocol,
fn(TProto2Out) -> EitherOutput<TProto1Out, TProto2Out>
>,
@ -801,7 +801,7 @@ where
upgrade::OrUpgrade<
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapUpgrade<
upgrade::MapOutboundUpgrade<
TProto1::OutboundProtocol,
fn(TProto1Out) -> EitherOutput<TProto1Out, TProto2Out>
>,
@ -814,7 +814,7 @@ where
>,
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapUpgrade<
upgrade::MapOutboundUpgrade<
TProto2::OutboundProtocol,
fn(TProto2Out) -> EitherOutput<TProto1Out, TProto2Out>
>,