mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-25 16:08:32 +00:00
fixup! refactor(core/rust): move InputStream to its own module
This commit is contained in:
parent
6c46c895ea
commit
13c577204c
@ -19,7 +19,7 @@ impl<'a> InputStream<'a> {
|
|||||||
Ok(Self::new(buf))
|
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
|
let buf = self
|
||||||
.buf
|
.buf
|
||||||
.get(self.pos..self.pos + len)
|
.get(self.pos..self.pos + len)
|
||||||
@ -37,11 +37,7 @@ impl<'a> InputStream<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_byte(&mut self) -> Result<u8, Error> {
|
pub fn read_byte(&mut self) -> Result<u8, Error> {
|
||||||
let val = self
|
let val = self.buf.get(self.pos).copied().ok_or(Error::EOFError)?;
|
||||||
.buf
|
|
||||||
.get(self.pos)
|
|
||||||
.copied()
|
|
||||||
.ok_or(Error::EOFError)?;
|
|
||||||
self.pos += 1;
|
self.pos += 1;
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user