From dd7dc0c1dc46b93cf63bccb4fe79260bea187a70 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Fri, 12 Sep 2025 18:25:10 -0400 Subject: [PATCH] Add `impl Read for &mut R` to `std_shims` Increases parity with `std::io`. --- Cargo.lock | 2 +- common/std-shims/Cargo.toml | 2 +- common/std-shims/src/io.rs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 694d654d..3824db8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10707,7 +10707,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "std-shims" -version = "0.1.4" +version = "0.1.5" dependencies = [ "hashbrown 0.16.0", "rustversion", diff --git a/common/std-shims/Cargo.toml b/common/std-shims/Cargo.toml index 9ca7adcf..84f22555 100644 --- a/common/std-shims/Cargo.toml +++ b/common/std-shims/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "std-shims" -version = "0.1.4" +version = "0.1.5" description = "A series of std shims to make alloc more feasible" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/common/std-shims" diff --git a/common/std-shims/src/io.rs b/common/std-shims/src/io.rs index 3f049a46..6ab8436b 100644 --- a/common/std-shims/src/io.rs +++ b/common/std-shims/src/io.rs @@ -64,6 +64,12 @@ mod shims { } } + impl Read for &mut R { + fn read(&mut self, buf: &mut [u8]) -> Result { + R::read(*self, buf) + } + } + pub trait BufRead: Read { fn fill_buf(&mut self) -> Result<&[u8]>; fn consume(&mut self, amt: usize);