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
sourceimpl<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
sourceimpl<R: Read, E: Endianness> ByteRead for ByteReader<R, E>
impl<R: Read, E: Endianness> ByteRead for ByteReader<R, E>
sourcefn read<N: Numeric>(&mut self) -> Result<N, Error>
fn read<N: Numeric>(&mut self) -> Result<N, Error>
Reads whole numeric value from stream Read more
sourcefn 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
sourcefn skip(&mut self, bytes: u32) -> Result<()>
fn skip(&mut self, bytes: u32) -> Result<()>
Skips the given number of bytes in the stream. Read more
Auto Trait Implementations
impl<R, E> RefUnwindSafe for ByteReader<R, E>where
E: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, E> Send for ByteReader<R, E>where
E: Send,
R: Send,
impl<R, E> Sync for ByteReader<R, E>where
E: Sync,
R: Sync,
impl<R, E> Unpin for ByteReader<R, E>where
E: Unpin,
R: Unpin,
impl<R, E> UnwindSafe for ByteReader<R, E>where
E: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more