about summary refs log tree commit diff
path: root/library/std/src/io/stdio.rs
diff options
context:
space:
mode:
authorAldan Tanneo <aldantanneo@gmail.com>2024-01-17 10:47:33 +0100
committerAldan Tanneo <aldantanneo@gmail.com>2024-01-17 10:47:33 +0100
commit1b9a01340b50cf015ec99519814628d6a28b7cfa (patch)
tree7e1838cbf5a244c5df057c363e63812469bd47a1 /library/std/src/io/stdio.rs
parentbf2637f4e89aab364d7ab28deb09820363bef86d (diff)
downloadrust-1b9a01340b50cf015ec99519814628d6a28b7cfa.tar.gz
rust-1b9a01340b50cf015ec99519814628d6a28b7cfa.zip
specialize `Bytes` on `StdinLock<'_>` by using the underlying `BufReader`
Diffstat (limited to 'library/std/src/io/stdio.rs')
-rw-r--r--library/std/src/io/stdio.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs
index 05b21eeb40f..261b570dee7 100644
--- a/library/std/src/io/stdio.rs
+++ b/library/std/src/io/stdio.rs
@@ -8,7 +8,9 @@ use crate::io::prelude::*;
 use crate::cell::{Cell, RefCell};
 use crate::fmt;
 use crate::fs::File;
-use crate::io::{self, BorrowedCursor, BufReader, IoSlice, IoSliceMut, LineWriter, Lines};
+use crate::io::{
+    self, BorrowedCursor, BufReader, IoSlice, IoSliceMut, LineWriter, Lines, SpecReadByte,
+};
 use crate::sync::atomic::{AtomicBool, Ordering};
 use crate::sync::{Arc, Mutex, MutexGuard, OnceLock, ReentrantMutex, ReentrantMutexGuard};
 use crate::sys::stdio;
@@ -483,6 +485,13 @@ impl Read for StdinLock<'_> {
     }
 }
 
+impl SpecReadByte for StdinLock<'_> {
+    #[inline]
+    fn spec_read_byte(&mut self) -> Option<io::Result<u8>> {
+        BufReader::spec_read_byte(&mut *self.inner)
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl BufRead for StdinLock<'_> {
     fn fill_buf(&mut self) -> io::Result<&[u8]> {