pub struct MemDecoder<'a> {
start: *const u8,
current: *const u8,
end: *const u8,
_marker: PhantomData<&'a u8>,
}
Fields§
§start: *const u8
§current: *const u8
§end: *const u8
§_marker: PhantomData<&'a u8>
Implementations§
source§impl<'a> MemDecoder<'a>
impl<'a> MemDecoder<'a>
pub fn new(data: &'a [u8], position: usize) -> Result<MemDecoder<'a>, ()>
pub fn split_at(&self, position: usize) -> MemDecoder<'a>
pub fn len(&self) -> usize
pub fn remaining(&self) -> usize
fn decoder_exhausted() -> !
pub fn read_array<const N: usize>(&mut self) -> [u8; N]
sourcepub fn with_position<F, T>(&mut self, pos: usize, func: F) -> Twhere
F: Fn(&mut MemDecoder<'a>) -> T,
pub fn with_position<F, T>(&mut self, pos: usize, func: F) -> Twhere
F: Fn(&mut MemDecoder<'a>) -> T,
While we could manually expose manipulation of the decoder position, all current users of that method would need to reset the position later, incurring the bounds check of set_position twice.
Trait Implementations§
source§impl<'a> Decodable<MemDecoder<'a>> for IntEncodedWithFixedSize
impl<'a> Decodable<MemDecoder<'a>> for IntEncodedWithFixedSize
fn decode(decoder: &mut MemDecoder<'a>) -> IntEncodedWithFixedSize
source§impl<'a> Decodable<MemDecoder<'a>> for Vec<u8>
impl<'a> Decodable<MemDecoder<'a>> for Vec<u8>
fn decode(d: &mut MemDecoder<'a>) -> Self
source§impl<'a> Decoder for MemDecoder<'a>
impl<'a> Decoder for MemDecoder<'a>
fn read_usize(&mut self) -> usize
fn read_u128(&mut self) -> u128
fn read_u64(&mut self) -> u64
fn read_u32(&mut self) -> u32
fn read_u16(&mut self) -> u16
fn read_u8(&mut self) -> u8
fn read_isize(&mut self) -> isize
fn read_i128(&mut self) -> i128
fn read_i64(&mut self) -> i64
fn read_i32(&mut self) -> i32
fn read_i16(&mut self) -> i16
fn read_raw_bytes(&mut self, bytes: usize) -> &'a [u8] ⓘ
fn peek_byte(&self) -> u8
fn position(&self) -> usize
fn read_i8(&mut self) -> i8
fn read_bool(&mut self) -> bool
fn read_char(&mut self) -> char
fn read_str(&mut self) -> &str
Auto Trait Implementations§
impl<'a> Freeze for MemDecoder<'a>
impl<'a> RefUnwindSafe for MemDecoder<'a>
impl<'a> !Send for MemDecoder<'a>
impl<'a> !Sync for MemDecoder<'a>
impl<'a> Unpin for MemDecoder<'a>
impl<'a> UnwindSafe for MemDecoder<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes