diff --git a/src/io/buf_read/mod.rs b/src/io/buf_read/mod.rs index 6018439a9..b65d17704 100644 --- a/src/io/buf_read/mod.rs +++ b/src/io/buf_read/mod.rs @@ -43,6 +43,12 @@ cfg_if! { /// [`futures::io::AsyncBufRead`]: /// https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html pub trait BufRead { + /// Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no + /// longer be returned in calls to `read`. + fn consume(&mut self, amt: usize) + where + Self: Unpin; + /// Returns the contents of the internal buffer, filling it with more data from the inner /// reader if it is empty. /// @@ -217,7 +223,11 @@ pub trait BufRead { } } -impl BufRead for T {} +impl BufRead for T { + fn consume(&mut self, amt: usize) { + AsyncBufRead::consume(Pin::new(self), amt) + } +} pub fn read_until_internal( mut reader: Pin<&mut R>,