Remove MemDecoder::read_byte
.
It's just a synonym for `read_u8`.
This commit is contained in:
parent
7a16d25365
commit
a676dfa888
1 changed files with 9 additions and 14 deletions
|
@ -504,19 +504,6 @@ impl<'a> MemDecoder<'a> {
|
||||||
panic!("MemDecoder exhausted")
|
panic!("MemDecoder exhausted")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn read_byte(&mut self) -> u8 {
|
|
||||||
if self.current == self.end {
|
|
||||||
Self::decoder_exhausted();
|
|
||||||
}
|
|
||||||
// SAFETY: This type guarantees current <= end, and we just checked current == end.
|
|
||||||
unsafe {
|
|
||||||
let byte = *self.current;
|
|
||||||
self.current = self.current.add(1);
|
|
||||||
byte
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_array<const N: usize>(&mut self) -> [u8; N] {
|
fn read_array<const N: usize>(&mut self) -> [u8; N] {
|
||||||
self.read_raw_bytes(N).try_into().unwrap()
|
self.read_raw_bytes(N).try_into().unwrap()
|
||||||
|
@ -586,7 +573,15 @@ impl<'a> Decoder for MemDecoder<'a> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_u8(&mut self) -> u8 {
|
fn read_u8(&mut self) -> u8 {
|
||||||
self.read_byte()
|
if self.current == self.end {
|
||||||
|
Self::decoder_exhausted();
|
||||||
|
}
|
||||||
|
// SAFETY: This type guarantees current <= end, and we just checked current == end.
|
||||||
|
unsafe {
|
||||||
|
let byte = *self.current;
|
||||||
|
self.current = self.current.add(1);
|
||||||
|
byte
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue