pub struct Decoder<'a> { /* private fields */ }Expand description
Reads values, signature-directed, bounds-checking every access.
Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
Sourcepub fn new(buf: &'a [u8], little_endian: bool) -> Self
pub fn new(buf: &'a [u8], little_endian: bool) -> Self
Decode a buffer whose position 0 is the alignment origin.
Sourcepub fn at(buf: &'a [u8], pos: usize, little_endian: bool) -> Self
pub fn at(buf: &'a [u8], pos: usize, little_endian: bool) -> Self
Decode starting at pos, keeping the same alignment origin — needed for
a header array, whose padding is measured from the start of the message.
pub fn position(&self) -> usize
pub fn remaining(&self) -> usize
pub fn align(&mut self, n: usize) -> Result<(), CodecError>
pub fn byte(&mut self) -> Result<u8, CodecError>
pub fn u16(&mut self) -> Result<u16, CodecError>
pub fn u32(&mut self) -> Result<u32, CodecError>
pub fn u64(&mut self) -> Result<u64, CodecError>
pub fn string(&mut self) -> Result<String, CodecError>
pub fn signature(&mut self) -> Result<String, CodecError>
Auto Trait Implementations§
impl<'a> Forget for Decoder<'a>
impl<'a> Freeze for Decoder<'a>
impl<'a> Move for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnsafeUnpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'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