Skip to content

Commit

Permalink
BufReader: document internal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lolbinarycat committed Jul 31, 2024
1 parent 79adfa2 commit 3ecadf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/io/buffered/bufreader/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Buffer {
self.pos = self.pos.saturating_sub(amt);
}

/// Read more bytes into the buffer without discarding any of its contents
pub fn read_more(&mut self, mut reader: impl Read) -> io::Result<()> {
let mut buf = BorrowedBuf::from(&mut self.buf[self.pos..]);
let old_init = self.initialized - self.pos;
Expand All @@ -109,6 +110,7 @@ impl Buffer {
Ok(())
}

/// Remove bytes that have already been read from the buffer.
pub fn backshift(&mut self) {
self.buf.copy_within(self.pos.., 0);
self.initialized -= self.pos;
Expand Down

0 comments on commit 3ecadf1

Please sign in to comment.