Skip to content

Commit a5e1cbe

Browse files
committed
Beef up BufRead::consume documentation.
Fixes #23196
1 parent ecf8c64 commit a5e1cbe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libstd/io/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,12 @@ pub trait BufRead: Read {
558558
/// This function does not perform any I/O, it simply informs this object
559559
/// that some amount of its buffer, returned from `fill_buf`, has been
560560
/// consumed and should no longer be returned.
561+
///
562+
/// This function is used to tell the buffer how many bytes you've consumed
563+
/// from the return value of `fill_buf`, and so may do odd things if
564+
/// `fill_buf` isn't called before calling this.
565+
///
566+
/// The `amt` must be `<=` the number of bytes in the buffer returned by `fill_buf`.
561567
#[stable(feature = "rust1", since = "1.0.0")]
562568
fn consume(&mut self, amt: usize);
563569

0 commit comments

Comments
 (0)