pub struct Decoder<'a> { /* private fields */ }
Expand description
Decoder type. Wraps a buffer which only contains bytes that have not been read yet
Implementations§
source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
sourcepub fn peek_u8(&self) -> DecodeResult<u8>
pub fn peek_u8(&self) -> DecodeResult<u8>
peek at the next byte without advancing the internal pointer
sourcepub fn read_u8(&mut self) -> DecodeResult<u8>
pub fn read_u8(&mut self) -> DecodeResult<u8>
read a u8
sourcepub fn read_u32(&mut self) -> DecodeResult<u32>
pub fn read_u32(&mut self) -> DecodeResult<u32>
read a u32
sourcepub fn read_i32(&mut self) -> DecodeResult<i32>
pub fn read_i32(&mut self) -> DecodeResult<i32>
read a i32
sourcepub fn read_u16(&mut self) -> DecodeResult<u16>
pub fn read_u16(&mut self) -> DecodeResult<u16>
read a u16
sourcepub fn read_u64(&mut self) -> DecodeResult<u64>
pub fn read_u64(&mut self) -> DecodeResult<u64>
read a u64
sourcepub fn read_cstring<const MAX: usize>(
&mut self
) -> DecodeResult<Option<CString>>
pub fn read_cstring<const MAX: usize>( &mut self ) -> DecodeResult<Option<CString>>
read a MAX
length bytes into nul terminated CString
pub fn read_nul_bytes<const MAX: usize>( &mut self ) -> DecodeResult<Option<Vec<u8>>>
sourcepub fn read_nul_string<const MAX: usize>(
&mut self
) -> DecodeResult<Option<String>>
pub fn read_nul_string<const MAX: usize>( &mut self ) -> DecodeResult<Option<String>>
read MAX
length bytes and read into utf-8 encoded String
sourcepub fn read_slice(&mut self, len: usize) -> DecodeResult<&'a [u8]>
pub fn read_slice(&mut self, len: usize) -> DecodeResult<&'a [u8]>
read a slice of bytes determined at runtime
sourcepub fn read_string(&mut self, len: usize) -> DecodeResult<String>
pub fn read_string(&mut self, len: usize) -> DecodeResult<String>
Read a utf-8 encoded String
sourcepub fn read_str(&mut self, len: usize) -> DecodeResult<&str>
pub fn read_str(&mut self, len: usize) -> DecodeResult<&str>
Read a utf-8 encoded String
sourcepub fn read_ipv4(&mut self, length: usize) -> DecodeResult<Ipv4Addr>
pub fn read_ipv4(&mut self, length: usize) -> DecodeResult<Ipv4Addr>
Read an ipv4 addr
sourcepub fn read_ipv4s(&mut self, length: usize) -> DecodeResult<Vec<Ipv4Addr>>
pub fn read_ipv4s(&mut self, length: usize) -> DecodeResult<Vec<Ipv4Addr>>
Read a list of ipv4 addrs
sourcepub fn read_ipv6s(&mut self, length: usize) -> DecodeResult<Vec<Ipv6Addr>>
pub fn read_ipv6s(&mut self, length: usize) -> DecodeResult<Vec<Ipv6Addr>>
Read a list of ipv6 addrs
sourcepub fn read_pair_ipv4s(
&mut self,
length: usize
) -> DecodeResult<Vec<(Ipv4Addr, Ipv4Addr)>>
pub fn read_pair_ipv4s( &mut self, length: usize ) -> DecodeResult<Vec<(Ipv4Addr, Ipv4Addr)>>
Read a list of ipv4 pairs
sourcepub fn read_domains(&mut self, length: usize) -> DecodeResult<Vec<Name>>
pub fn read_domains(&mut self, length: usize) -> DecodeResult<Vec<Name>>
Read a list of domain Name
s
sourcepub fn read_bool(&mut self) -> DecodeResult<bool>
pub fn read_bool(&mut self) -> DecodeResult<bool>
Read a bool
Trait Implementations§
Auto Trait Implementations§
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> 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