Add impl<R: Read> Read for &mut R to std_shims

Increases parity with `std::io`.
This commit is contained in:
Luke Parker
2025-09-12 18:25:10 -04:00
parent 87b4dfc8f3
commit 29093715e3
3 changed files with 8 additions and 2 deletions

View File

@@ -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"

View File

@@ -64,6 +64,12 @@ mod shims {
}
}
impl<R: Read> Read for &mut R {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
R::read(*self, buf)
}
}
pub trait BufRead: Read {
fn fill_buf(&mut self) -> Result<&[u8]>;
fn consume(&mut self, amt: usize);