about summary refs log tree commit diff
path: root/library/std/src/io/stdio.rs
diff options
context:
space:
mode:
authorAïssata <aimaiga2@gmail.com>2022-07-11 13:12:41 +0000
committerAïssata <aimaiga2@gmail.com>2022-07-11 13:12:41 +0000
commit709ea7469f5093fb488607fcb966445c63d49a7a (patch)
treead1239bd8c5503f0083a6852370abecba1631b75 /library/std/src/io/stdio.rs
parent0250ef2571185b05701ed9d74fc904c17508a397 (diff)
downloadrust-709ea7469f5093fb488607fcb966445c63d49a7a.tar.gz
rust-709ea7469f5093fb488607fcb966445c63d49a7a.zip
Add Read Impl for &Stdin
Diffstat (limited to 'library/std/src/io/stdio.rs')
-rw-r--r--library/std/src/io/stdio.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs
index 261b570dee7..e929eaa6396 100644
--- a/library/std/src/io/stdio.rs
+++ b/library/std/src/io/stdio.rs
@@ -445,6 +445,29 @@ impl Read for Stdin {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl Read for &Stdin {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.lock().read(buf)
+    }
+    fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
+        self.lock().read_vectored(bufs)
+    }
+    #[inline]
+    fn is_read_vectored(&self) -> bool {
+        self.lock().is_read_vectored()
+    }
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+        self.lock().read_to_end(buf)
+    }
+    fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+        self.lock().read_to_string(buf)
+    }
+    fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
+        self.lock().read_exact(buf)
+    }
+}
+
 // only used by platform-dependent io::copy specializations, i.e. unused on some platforms
 #[cfg(any(target_os = "linux", target_os = "android"))]
 impl StdinLock<'_> {