diff options
| author | Guillaume Boisseau <Nadrieril@users.noreply.github.com> | 2024-03-09 21:40:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-09 21:40:05 +0100 |
| commit | 0a8ea93dd8352e519acedc1fd6d790f5fa8cad62 (patch) | |
| tree | 889b98508b8b1a190f5be008d97c2f94eaa49706 /library/std/src/io/stdio.rs | |
| parent | 8401645716b26a8b4c6974dc0680e55e81e9e8a1 (diff) | |
| parent | b18280f9d5d07ff1a1b5352924c383c1ed3024e9 (diff) | |
| download | rust-0a8ea93dd8352e519acedc1fd6d790f5fa8cad62.tar.gz rust-0a8ea93dd8352e519acedc1fd6d790f5fa8cad62.zip | |
Rollup merge of #99153 - Dajamante:issue/95622, r=dtolnay
Add Read Impl for &Stdin r? `@oli-obk` fixes #95622
Diffstat (limited to 'library/std/src/io/stdio.rs')
| -rw-r--r-- | library/std/src/io/stdio.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 42fc0053030..ccc2ed91688 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -453,6 +453,32 @@ impl Read for Stdin { } } +#[stable(feature = "read_shared_stdin", since = "CURRENT_RUSTC_VERSION")] +impl Read for &Stdin { + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + self.lock().read(buf) + } + fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { + self.lock().read_buf(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<'_> { |
