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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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