File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,13 @@ pub(super) fn split<T: AsyncRead + AsyncWrite>(t: T) -> (ReadHalf<T>, WriteHalf<
31
31
( ReadHalf { handle : a } , WriteHalf { handle : b } )
32
32
}
33
33
34
+ impl < T > ReadHalf < T > {
35
+ /// Checks if this `ReadHalf` and some `WriteHalf` were split from the same stream.
36
+ pub fn is_pair_of ( & self , other : & WriteHalf < T > ) -> bool {
37
+ self . handle . is_pair_of ( & other. handle )
38
+ }
39
+ }
40
+
34
41
impl < T : Unpin > ReadHalf < T > {
35
42
/// Attempts to put the two "halves" of a split `AsyncRead + AsyncWrite` back
36
43
/// together. Succeeds only if the `ReadHalf<T>` and `WriteHalf<T>` are
@@ -42,6 +49,13 @@ impl<T: Unpin> ReadHalf<T> {
42
49
}
43
50
}
44
51
52
+ impl < T > WriteHalf < T > {
53
+ /// Checks if this `WriteHalf` and some `ReadHalf` were split from the same stream.
54
+ pub fn is_pair_of ( & self , other : & ReadHalf < T > ) -> bool {
55
+ self . handle . is_pair_of ( & other. handle )
56
+ }
57
+ }
58
+
45
59
impl < T : Unpin > WriteHalf < T > {
46
60
/// Attempts to put the two "halves" of a split `AsyncRead + AsyncWrite` back
47
61
/// together. Succeeds only if the `ReadHalf<T>` and `WriteHalf<T>` are
You can’t perform that action at this time.
0 commit comments