@@ -43,6 +43,12 @@ cfg_if! {
4343/// [`futures::io::AsyncBufRead`]:
4444/// https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
4545pub 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+
4652 /// Returns the contents of the internal buffer, filling it with more data from the inner
4753 /// reader if it is empty.
4854 ///
@@ -63,15 +69,6 @@ pub trait BufRead {
6369 FillBufFuture :: new ( self )
6470 }
6571
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-
7572 /// Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
7673 ///
7774 /// This function will read bytes from the underlying stream until the delimiter or EOF is
@@ -226,7 +223,11 @@ pub trait BufRead {
226223 }
227224}
228225
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+ }
230231
231232pub fn read_until_internal < R : AsyncBufRead + ?Sized > (
232233 mut reader : Pin < & mut R > ,
0 commit comments