@@ -24,14 +24,7 @@ use crate::{
24
24
} ;
25
25
use either:: Either ;
26
26
27
- /// A type to represent two possible upgrade types (inbound or outbound).
28
- #[ derive( Debug , Clone ) ]
29
- pub enum EitherUpgrade < A , B > {
30
- A ( A ) ,
31
- B ( B ) ,
32
- }
33
-
34
- impl < A , B > UpgradeInfo for EitherUpgrade < A , B >
27
+ impl < A , B > UpgradeInfo for Either < A , B >
35
28
where
36
29
A : UpgradeInfo ,
37
30
B : UpgradeInfo ,
@@ -44,13 +37,13 @@ where
44
37
45
38
fn protocol_info ( & self ) -> Self :: InfoIter {
46
39
match self {
47
- EitherUpgrade :: A ( a) => EitherIter :: A ( a. protocol_info ( ) . into_iter ( ) ) ,
48
- EitherUpgrade :: B ( b) => EitherIter :: B ( b. protocol_info ( ) . into_iter ( ) ) ,
40
+ Either :: Left ( a) => EitherIter :: A ( a. protocol_info ( ) . into_iter ( ) ) ,
41
+ Either :: Right ( b) => EitherIter :: B ( b. protocol_info ( ) . into_iter ( ) ) ,
49
42
}
50
43
}
51
44
}
52
45
53
- impl < C , A , B , TA , TB , EA , EB > InboundUpgrade < C > for EitherUpgrade < A , B >
46
+ impl < C , A , B , TA , TB , EA , EB > InboundUpgrade < C > for Either < A , B >
54
47
where
55
48
A : InboundUpgrade < C , Output = TA , Error = EA > ,
56
49
B : InboundUpgrade < C , Output = TB , Error = EB > ,
@@ -61,18 +54,18 @@ where
61
54
62
55
fn upgrade_inbound ( self , sock : C , info : Self :: Info ) -> Self :: Future {
63
56
match ( self , info) {
64
- ( EitherUpgrade :: A ( a) , EitherName :: A ( info) ) => {
57
+ ( Either :: Left ( a) , EitherName :: A ( info) ) => {
65
58
EitherFuture2 :: A ( a. upgrade_inbound ( sock, info) )
66
59
}
67
- ( EitherUpgrade :: B ( b) , EitherName :: B ( info) ) => {
60
+ ( Either :: Right ( b) , EitherName :: B ( info) ) => {
68
61
EitherFuture2 :: B ( b. upgrade_inbound ( sock, info) )
69
62
}
70
63
_ => panic ! ( "Invalid invocation of EitherUpgrade::upgrade_inbound" ) ,
71
64
}
72
65
}
73
66
}
74
67
75
- impl < C , A , B , TA , TB , EA , EB > OutboundUpgrade < C > for EitherUpgrade < A , B >
68
+ impl < C , A , B , TA , TB , EA , EB > OutboundUpgrade < C > for Either < A , B >
76
69
where
77
70
A : OutboundUpgrade < C , Output = TA , Error = EA > ,
78
71
B : OutboundUpgrade < C , Output = TB , Error = EB > ,
@@ -83,10 +76,10 @@ where
83
76
84
77
fn upgrade_outbound ( self , sock : C , info : Self :: Info ) -> Self :: Future {
85
78
match ( self , info) {
86
- ( EitherUpgrade :: A ( a) , EitherName :: A ( info) ) => {
79
+ ( Either :: Left ( a) , EitherName :: A ( info) ) => {
87
80
EitherFuture2 :: A ( a. upgrade_outbound ( sock, info) )
88
81
}
89
- ( EitherUpgrade :: B ( b) , EitherName :: B ( info) ) => {
82
+ ( Either :: Right ( b) , EitherName :: B ( info) ) => {
90
83
EitherFuture2 :: B ( b. upgrade_outbound ( sock, info) )
91
84
}
92
85
_ => panic ! ( "Invalid invocation of EitherUpgrade::upgrade_outbound" ) ,
0 commit comments