@@ -2,7 +2,7 @@ use async_h1::{
22 client:: Encoder ,
33 server:: { ConnectionStatus , Server } ,
44} ;
5- use async_std:: io:: { Read , Write } ;
5+ use async_std:: io:: { Read as AsyncRead , Write as AsyncWrite } ;
66use http_types:: { Request , Response , Result } ;
77use std:: {
88 fmt:: { Debug , Display } ,
5858 }
5959}
6060
61- impl < F , Fut > Read for TestServer < F , Fut >
61+ impl < F , Fut > AsyncRead for TestServer < F , Fut >
6262where
6363 F : Fn ( Request ) -> Fut ,
6464 Fut : Future < Output = Result < Response > > ,
7272 }
7373}
7474
75- impl < F , Fut > Write for TestServer < F , Fut >
75+ impl < F , Fut > AsyncWrite for TestServer < F , Fut >
7676where
7777 F : Fn ( Request ) -> Fut ,
7878 Fut : Future < Output = Result < Response > > ,
@@ -187,7 +187,17 @@ impl Debug for CloseableCursor {
187187 }
188188}
189189
190- impl Read for & CloseableCursor {
190+ impl AsyncRead for CloseableCursor {
191+ fn poll_read (
192+ self : Pin < & mut Self > ,
193+ cx : & mut Context < ' _ > ,
194+ buf : & mut [ u8 ] ,
195+ ) -> Poll < io:: Result < usize > > {
196+ Pin :: new ( & mut & * self ) . poll_read ( cx, buf)
197+ }
198+ }
199+
200+ impl AsyncRead for & CloseableCursor {
191201 fn poll_read (
192202 self : Pin < & mut Self > ,
193203 cx : & mut Context < ' _ > ,
@@ -209,7 +219,7 @@ impl Read for &CloseableCursor {
209219 }
210220}
211221
212- impl Write for & CloseableCursor {
222+ impl AsyncWrite for & CloseableCursor {
213223 fn poll_write (
214224 self : Pin < & mut Self > ,
215225 _cx : & mut Context < ' _ > ,
@@ -237,7 +247,7 @@ impl Write for &CloseableCursor {
237247 }
238248}
239249
240- impl Read for TestIO {
250+ impl AsyncRead for TestIO {
241251 fn poll_read (
242252 self : Pin < & mut Self > ,
243253 cx : & mut Context < ' _ > ,
@@ -247,7 +257,7 @@ impl Read for TestIO {
247257 }
248258}
249259
250- impl Write for TestIO {
260+ impl AsyncWrite for TestIO {
251261 fn poll_write (
252262 self : Pin < & mut Self > ,
253263 cx : & mut Context < ' _ > ,
@@ -264,3 +274,13 @@ impl Write for TestIO {
264274 Pin :: new ( & mut & * self . write ) . poll_close ( cx)
265275 }
266276}
277+
278+ impl std:: io:: Write for CloseableCursor {
279+ fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
280+ self . 0 . write ( ) . unwrap ( ) . data . write ( buf)
281+ }
282+
283+ fn flush ( & mut self ) -> io:: Result < ( ) > {
284+ Ok ( ( ) )
285+ }
286+ }
0 commit comments