Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1579,18 +1579,13 @@ pub trait BufRead: Read {
/// let stdin = io::stdin();
/// let mut stdin = stdin.lock();
///
/// // we can't have two `&mut` references to `stdin`, so use a block
/// // to end the borrow early.
/// let length = {
/// let buffer = stdin.fill_buf().unwrap();
/// let buffer = stdin.fill_buf().unwrap();
///
/// // work with buffer
/// println!("{:?}", buffer);
///
/// buffer.len()
/// };
/// // work with buffer
/// println!("{:?}", buffer);
///
/// // ensure the bytes we worked with aren't returned again later
/// let length = buffer.len();
/// stdin.consume(length);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down