From 3ecadf1755fd6bbbfcb191c6060419f6633de10e Mon Sep 17 00:00:00 2001 From: binarycat Date: Wed, 31 Jul 2024 15:32:48 -0400 Subject: [PATCH] BufReader: document internal functions --- library/std/src/io/buffered/bufreader/buffer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/io/buffered/bufreader/buffer.rs b/library/std/src/io/buffered/bufreader/buffer.rs index 4790527647a7c..ccd67fafb45b4 100644 --- a/library/std/src/io/buffered/bufreader/buffer.rs +++ b/library/std/src/io/buffered/bufreader/buffer.rs @@ -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; @@ -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;