diff options
| author | bors <bors@rust-lang.org> | 2024-04-10 11:38:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-10 11:38:15 +0000 |
| commit | e908cfd125ae9d98550edb9ffd8d7eae4be601ac (patch) | |
| tree | 5521b2b64193518cf054fe3af5d5753886d6626c /library/std/src/io/stdio.rs | |
| parent | b14d8b2ef20c64c1002e2c6c724025c3d0846b91 (diff) | |
| parent | 87348093954be36b2583dda2e6e842950d346254 (diff) | |
| download | rust-e908cfd125ae9d98550edb9ffd8d7eae4be601ac.tar.gz rust-e908cfd125ae9d98550edb9ffd8d7eae4be601ac.zip | |
Auto merge of #122393 - a1phyr:specialize_read_buf_exact, r=joboet
Specialize many implementations of `Read::read_buf_exact` This makes all implementations of `Read` that have a specialized `read_exact` implementation also have one for `read_buf_exact`.
Diffstat (limited to 'library/std/src/io/stdio.rs')
| -rw-r--r-- | library/std/src/io/stdio.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 8f60b3b1535..73fa7cbc3fe 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -451,6 +451,9 @@ impl Read for Stdin { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { self.lock().read_exact(buf) } + fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { + self.lock().read_buf_exact(cursor) + } } #[stable(feature = "read_shared_stdin", since = "1.78.0")] @@ -477,6 +480,9 @@ impl Read for &Stdin { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { self.lock().read_exact(buf) } + fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { + self.lock().read_buf_exact(cursor) + } } // only used by platform-dependent io::copy specializations, i.e. unused on some platforms @@ -517,6 +523,10 @@ impl Read for StdinLock<'_> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { self.inner.read_exact(buf) } + + fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { + self.inner.read_buf_exact(cursor) + } } impl SpecReadByte for StdinLock<'_> { |
