Skip to content

Commit 43e581a

Browse files
committed
Add read_buf_vectored and note about appends
1 parent 8b1de5f commit 43e581a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

text/0000-read-buf.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub trait Read {
386386
/// Pull some bytes from this source into the specified buffer.
387387
///
388388
/// This is equivalent to the `read` method, except that it is passed a `ReadBuf` rather than `[u8]` to allow use
389-
/// with uninitialized buffers.
389+
/// with uninitialized buffers. The new data will be appended to any existing contents of `buf`.
390390
///
391391
/// The default implementation delegates to `read`.
392392
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> io::Result<()> {
@@ -558,6 +558,19 @@ impl<'a> ReadBufs<'a> {
558558

559559
...
560560
}
561+
562+
pub trait Read {
563+
/// Pull some bytes from this source into the specified set of buffers.
564+
///
565+
/// This is equivalent to the `read_vectored` method, except that it is passed a `ReadBufs` rather than
566+
/// `[IoSliceMut]` to allow use with uninitialized buffers. The new data will be appended to any existing contents
567+
/// of `bufs`.
568+
///
569+
/// The default implementation delegates to `read_vectored`.
570+
fn read_buf_vectored(&mut self, bufs: &mut ReadBufs<'_>) -> io::Result<()> {
571+
...
572+
}
573+
}
561574
```
562575

563576
# Drawbacks

0 commit comments

Comments
 (0)