pub struct BinReader<'a, R: Read> { /* private fields */ }
Expand description
Utility to read from a binary source
Implementations§
source§impl<'a, R: Read> BinReader<'a, R>
impl<'a, R: Read> BinReader<'a, R>
sourcepub fn new(
source: &'a mut R,
version: ProtocolVersion,
mode: DeserializationMode
) -> Self
pub fn new( source: &'a mut R, version: ProtocolVersion, mode: DeserializationMode ) -> Self
Constructor for a new BinReader for the provided source and protocol version.
Trait Implementations§
source§impl<'a, R: Read> Reader for BinReader<'a, R>
impl<'a, R: Read> Reader for BinReader<'a, R>
Utility wrapper for an underlying byte Reader. Defines higher level methods to read numbers, byte vectors, hashes, etc.
source§fn read_bytes_len_prefix(&mut self) -> Result<Vec<u8>, Error>
fn read_bytes_len_prefix(&mut self) -> Result<Vec<u8>, Error>
Read a variable size vector from the underlying Read. Expects a usize
source§fn read_fixed_bytes(&mut self, len: usize) -> Result<Vec<u8>, Error>
fn read_fixed_bytes(&mut self, len: usize) -> Result<Vec<u8>, Error>
Read a fixed number of bytes.
source§fn deserialization_mode(&self) -> DeserializationMode
fn deserialization_mode(&self) -> DeserializationMode
The mode this reader is reading from
source§fn expect_u8(&mut self, val: u8) -> Result<u8, Error>
fn expect_u8(&mut self, val: u8) -> Result<u8, Error>
Consumes a byte from the reader, producing an error if it doesn’t have
the expected value
source§fn protocol_version(&self) -> ProtocolVersion
fn protocol_version(&self) -> ProtocolVersion
Access to underlying protocol version to support
version specific deserialization logic.
Auto Trait Implementations§
impl<'a, R> Freeze for BinReader<'a, R>
impl<'a, R> RefUnwindSafe for BinReader<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for BinReader<'a, R>where
R: Send,
impl<'a, R> Sync for BinReader<'a, R>where
R: Sync,
impl<'a, R> Unpin for BinReader<'a, R>
impl<'a, R> !UnwindSafe for BinReader<'a, R>
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