Skip to content

Commit abda966

Browse files
committed
bufreader::consume
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 2c02037 commit abda966

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/io/buf_read/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ cfg_if! {
4141
/// [`futures::io::AsyncBufRead`]:
4242
/// https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
4343
pub trait BufRead {
44+
/// Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no
45+
/// longer be returned in calls to `read`.
46+
fn consume(self: Pin<&mut Self>, amt: usize)
47+
where
48+
Self: AsyncBufRead,
49+
{
50+
AsyncBufRead::consume(self, amt)
51+
}
52+
4453
/// Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
4554
///
4655
/// This function will read bytes from the underlying stream until the delimiter or EOF is

0 commit comments

Comments
 (0)