@@ -2,7 +2,7 @@ use async_h1::{
2
2
client:: Encoder ,
3
3
server:: { ConnectionStatus , Server } ,
4
4
} ;
5
- use async_std:: io:: { Read , Write } ;
5
+ use async_std:: io:: { Read as AsyncRead , Write as AsyncWrite } ;
6
6
use http_types:: { Request , Response , Result } ;
7
7
use std:: {
8
8
fmt:: { Debug , Display } ,
58
58
}
59
59
}
60
60
61
- impl < F , Fut > Read for TestServer < F , Fut >
61
+ impl < F , Fut > AsyncRead for TestServer < F , Fut >
62
62
where
63
63
F : Fn ( Request ) -> Fut ,
64
64
Fut : Future < Output = Result < Response > > ,
72
72
}
73
73
}
74
74
75
- impl < F , Fut > Write for TestServer < F , Fut >
75
+ impl < F , Fut > AsyncWrite for TestServer < F , Fut >
76
76
where
77
77
F : Fn ( Request ) -> Fut ,
78
78
Fut : Future < Output = Result < Response > > ,
@@ -187,7 +187,17 @@ impl Debug for CloseableCursor {
187
187
}
188
188
}
189
189
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 {
191
201
fn poll_read (
192
202
self : Pin < & mut Self > ,
193
203
cx : & mut Context < ' _ > ,
@@ -209,7 +219,7 @@ impl Read for &CloseableCursor {
209
219
}
210
220
}
211
221
212
- impl Write for & CloseableCursor {
222
+ impl AsyncWrite for & CloseableCursor {
213
223
fn poll_write (
214
224
self : Pin < & mut Self > ,
215
225
_cx : & mut Context < ' _ > ,
@@ -237,7 +247,7 @@ impl Write for &CloseableCursor {
237
247
}
238
248
}
239
249
240
- impl Read for TestIO {
250
+ impl AsyncRead for TestIO {
241
251
fn poll_read (
242
252
self : Pin < & mut Self > ,
243
253
cx : & mut Context < ' _ > ,
@@ -247,7 +257,7 @@ impl Read for TestIO {
247
257
}
248
258
}
249
259
250
- impl Write for TestIO {
260
+ impl AsyncWrite for TestIO {
251
261
fn poll_write (
252
262
self : Pin < & mut Self > ,
253
263
cx : & mut Context < ' _ > ,
@@ -264,3 +274,13 @@ impl Write for TestIO {
264
274
Pin :: new ( & mut & * self . write ) . poll_close ( cx)
265
275
}
266
276
}
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