1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-24 15:38:22 +00:00

fixup! refactor(core/rust): move InputStream to its own module

This commit is contained in:
matejcik 2024-01-18 10:28:43 +01:00
parent 6c46c895ea
commit 13c577204c

View File

@ -19,7 +19,7 @@ impl<'a> InputStream<'a> {
Ok(Self::new(buf))
}
pub fn read(&mut self, len: usize) -> Result<&[u8], Error> {
pub fn read(&mut self, len: usize) -> Result<&'a [u8], Error> {
let buf = self
.buf
.get(self.pos..self.pos + len)
@ -37,11 +37,7 @@ impl<'a> InputStream<'a> {
}
pub fn read_byte(&mut self) -> Result<u8, Error> {
let val = self
.buf
.get(self.pos)
.copied()
.ok_or(Error::EOFError)?;
let val = self.buf.get(self.pos).copied().ok_or(Error::EOFError)?;
self.pos += 1;
Ok(val)
}