@@ -3,6 +3,7 @@ use std::io;
3
3
use std:: pin:: Pin ;
4
4
use std:: task:: { Context , Poll } ;
5
5
6
+ use bytes:: { Buf , BufMut } ;
6
7
use hyper:: client:: connect:: { Connected , Connection } ;
7
8
use tokio:: io:: { AsyncRead , AsyncWrite } ;
8
9
pub use tokio_tls:: TlsStream ;
@@ -58,6 +59,18 @@ impl<T: AsyncRead + AsyncWrite + Unpin> AsyncRead for MaybeHttpsStream<T> {
58
59
MaybeHttpsStream :: Https ( s) => Pin :: new ( s) . poll_read ( cx, buf) ,
59
60
}
60
61
}
62
+
63
+ #[ inline]
64
+ fn poll_read_buf < B : BufMut > (
65
+ self : Pin < & mut Self > ,
66
+ cx : & mut Context < ' _ > ,
67
+ buf : & mut B ,
68
+ ) -> Poll < Result < usize , io:: Error > > {
69
+ match Pin :: get_mut ( self ) {
70
+ MaybeHttpsStream :: Http ( s) => Pin :: new ( s) . poll_read_buf ( cx, buf) ,
71
+ MaybeHttpsStream :: Https ( s) => Pin :: new ( s) . poll_read_buf ( cx, buf) ,
72
+ }
73
+ }
61
74
}
62
75
63
76
impl < T : AsyncWrite + AsyncRead + Unpin > AsyncWrite for MaybeHttpsStream < T > {
@@ -73,6 +86,18 @@ impl<T: AsyncWrite + AsyncRead + Unpin> AsyncWrite for MaybeHttpsStream<T> {
73
86
}
74
87
}
75
88
89
+ #[ inline]
90
+ fn poll_write_buf < B : Buf > (
91
+ self : Pin < & mut Self > ,
92
+ cx : & mut Context < ' _ > ,
93
+ buf : & mut B ,
94
+ ) -> Poll < Result < usize , io:: Error > > {
95
+ match Pin :: get_mut ( self ) {
96
+ MaybeHttpsStream :: Http ( s) => Pin :: new ( s) . poll_write_buf ( cx, buf) ,
97
+ MaybeHttpsStream :: Https ( s) => Pin :: new ( s) . poll_write_buf ( cx, buf) ,
98
+ }
99
+ }
100
+
76
101
#[ inline]
77
102
fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , io:: Error > > {
78
103
match Pin :: get_mut ( self ) {
0 commit comments