about summary refs log tree commit diff
path: root/library/std/src/io/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/io/util.rs')
-rw-r--r--library/std/src/io/util.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/io/util.rs b/library/std/src/io/util.rs
index b4c4dffc371..424f862090f 100644
--- a/library/std/src/io/util.rs
+++ b/library/std/src/io/util.rs
@@ -188,6 +188,13 @@ impl Read for Repeat {
         Ok(buf.len())
     }
 
+    fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
+        for slot in &mut *buf {
+            *slot = self.byte;
+        }
+        Ok(())
+    }
+
     fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> {
         // SAFETY: No uninit bytes are being written
         for slot in unsafe { buf.as_mut() } {
@@ -204,6 +211,10 @@ impl Read for Repeat {
         Ok(())
     }
 
+    fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> {
+        self.read_buf(buf)
+    }
+
     /// This function is not supported by `io::Repeat`, because there's no end of its data
     fn read_to_end(&mut self, _: &mut Vec<u8>) -> io::Result<usize> {
         Err(io::Error::from(io::ErrorKind::OutOfMemory))