Skip to content

Commit a0a33c7

Browse files
authored
Unrolled build for rust-lang#99153
Rollup merge of rust-lang#99153 - Dajamante:issue/95622, r=dtolnay Add Read Impl for &Stdin r? `@oli-obk` fixes rust-lang#95622
2 parents 25ee3c6 + b18280f commit a0a33c7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

library/std/src/io/stdio.rs

+26
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,32 @@ impl Read for Stdin {
453453
}
454454
}
455455

456+
#[stable(feature = "read_shared_stdin", since = "CURRENT_RUSTC_VERSION")]
457+
impl Read for &Stdin {
458+
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
459+
self.lock().read(buf)
460+
}
461+
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> {
462+
self.lock().read_buf(buf)
463+
}
464+
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
465+
self.lock().read_vectored(bufs)
466+
}
467+
#[inline]
468+
fn is_read_vectored(&self) -> bool {
469+
self.lock().is_read_vectored()
470+
}
471+
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
472+
self.lock().read_to_end(buf)
473+
}
474+
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
475+
self.lock().read_to_string(buf)
476+
}
477+
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
478+
self.lock().read_exact(buf)
479+
}
480+
}
481+
456482
// only used by platform-dependent io::copy specializations, i.e. unused on some platforms
457483
#[cfg(any(target_os = "linux", target_os = "android"))]
458484
impl StdinLock<'_> {

0 commit comments

Comments
 (0)