Struct bitstream_io::read::ByteReader
source · pub struct ByteReader<R: Read, E: Endianness> { /* private fields */ }
Expand description
For reading aligned bytes from a stream of bytes in a given endianness.
This only reads aligned values and maintains no internal state.
Implementations§
source§impl<R: Read, E: Endianness> ByteReader<R, E>
impl<R: Read, E: Endianness> ByteReader<R, E>
sourcepub fn new(reader: R) -> ByteReader<R, E>
pub fn new(reader: R) -> ByteReader<R, E>
Wraps a ByteReader around something that implements Read
sourcepub fn endian(reader: R, _endian: E) -> ByteReader<R, E>
pub fn endian(reader: R, _endian: E) -> ByteReader<R, E>
Wraps a ByteReader around something that implements Read
with the given endianness.
sourcepub fn into_reader(self) -> R
pub fn into_reader(self) -> R
Unwraps internal reader and disposes of ByteReader
.
sourcepub fn into_bitreader(self) -> BitReader<R, E>
pub fn into_bitreader(self) -> BitReader<R, E>
Converts ByteReader
to BitReader
in the same endianness.
Trait Implementations§
source§impl<R: Read, E: Endianness> ByteRead for ByteReader<R, E>
impl<R: Read, E: Endianness> ByteRead for ByteReader<R, E>
source§fn read<V: Primitive>(&mut self) -> Result<V, Error>
fn read<V: Primitive>(&mut self) -> Result<V, Error>
Reads whole numeric value from stream Read more
source§fn read_bytes(&mut self, buf: &mut [u8]) -> Result<()>
fn read_bytes(&mut self, buf: &mut [u8]) -> Result<()>
Completely fills the given buffer with whole bytes. Read more
source§fn skip(&mut self, bytes: u32) -> Result<()>
fn skip(&mut self, bytes: u32) -> Result<()>
Skips the given number of bytes in the stream. Read more
source§fn reader_ref(&mut self) -> &mut dyn Read
fn reader_ref(&mut self) -> &mut dyn Read
Returns mutable reference to underlying reader
source§fn read_to_bytes<const SIZE: usize>(&mut self) -> Result<[u8; SIZE]>
fn read_to_bytes<const SIZE: usize>(&mut self) -> Result<[u8; SIZE]>
👎Deprecated since 1.8.0: use read() method instead
Completely fills a whole buffer with bytes and returns it. Read more
source§fn read_to_vec(&mut self, bytes: usize) -> Result<Vec<u8>>
fn read_to_vec(&mut self, bytes: usize) -> Result<Vec<u8>>
Completely fills a vector of bytes and returns it. Read more
source§fn parse_with<F: FromByteStreamWith>(
&mut self,
context: &F::Context
) -> Result<F, F::Error>
fn parse_with<F: FromByteStreamWith>( &mut self, context: &F::Context ) -> Result<F, F::Error>
Parses and returns complex type with context
Auto Trait Implementations§
impl<R, E> Freeze for ByteReader<R, E>where
R: Freeze,
impl<R, E> RefUnwindSafe for ByteReader<R, E>where
R: RefUnwindSafe,
E: RefUnwindSafe,
impl<R, E> Send for ByteReader<R, E>
impl<R, E> Sync for ByteReader<R, E>
impl<R, E> Unpin for ByteReader<R, E>
impl<R, E> UnwindSafe for ByteReader<R, E>where
R: UnwindSafe,
E: UnwindSafe,
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