@@ -43,6 +43,12 @@ cfg_if! {
43
43
/// [`futures::io::AsyncBufRead`]:
44
44
/// https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
45
45
pub trait BufRead {
46
+ /// Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no
47
+ /// longer be returned in calls to `read`.
48
+ fn consume ( & mut self , amt : usize )
49
+ where
50
+ Self : Unpin ;
51
+
46
52
/// Returns the contents of the internal buffer, filling it with more data from the inner
47
53
/// reader if it is empty.
48
54
///
@@ -63,15 +69,6 @@ pub trait BufRead {
63
69
FillBufFuture :: new ( self )
64
70
}
65
71
66
- /// Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no
67
- /// longer be returned in calls to `read`.
68
- fn consume ( & mut self , amt : usize )
69
- where
70
- Self : AsyncBufRead + Unpin ,
71
- {
72
- AsyncBufRead :: consume ( Pin :: new ( self ) , amt)
73
- }
74
-
75
72
/// Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
76
73
///
77
74
/// This function will read bytes from the underlying stream until the delimiter or EOF is
@@ -226,7 +223,11 @@ pub trait BufRead {
226
223
}
227
224
}
228
225
229
- impl < T : AsyncBufRead + Unpin + ?Sized > BufRead for T { }
226
+ impl < T : AsyncBufRead + Unpin + ?Sized > BufRead for T {
227
+ fn consume ( & mut self , amt : usize ) {
228
+ AsyncBufRead :: consume ( Pin :: new ( self ) , amt)
229
+ }
230
+ }
230
231
231
232
pub fn read_until_internal < R : AsyncBufRead + ?Sized > (
232
233
mut reader : Pin < & mut R > ,
0 commit comments