Struct ByteReader

struct ByteReader<R: io::Read, E: Endianness> { ... }

For reading aligned bytes from a stream of bytes in a given endianness.

This only reads aligned values and maintains no internal state.

Implementations

impl<R: io::Read, E: Endianness> ByteReader<R, E>

fn new(reader: R) -> ByteReader<R, E>

Wraps a ByteReader around something that implements Read

fn endian(reader: R, _endian: E) -> ByteReader<R, E>

Wraps a ByteReader around something that implements Read with the given endianness.

fn into_reader(self: Self) -> R

Unwraps internal reader and disposes of ByteReader.

fn reader(self: &mut Self) -> &mut R

Provides mutable reference to internal reader

fn into_bitreader(self: Self) -> BitReader<R, E>

Converts ByteReader to BitReader in the same endianness.

fn bitreader(self: &mut Self) -> BitReader<&mut R, E>

Provides temporary BitReader in the same endianness.

Warning

Any unread bits left over when BitReader is dropped are lost.

impl<R, E> Freeze for ByteReader<R, E>

impl<R, E> RefUnwindSafe for ByteReader<R, E>

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> UnsafeUnpin for ByteReader<R, E>

impl<R, E> UnwindSafe for ByteReader<R, E>

impl<R: $crate::fmt::Debug + io::Read, E: $crate::fmt::Debug + Endianness> Debug for ByteReader<R, E>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<R: io::Read, E: Endianness> ByteRead for ByteReader<R, E>

fn read<V>(self: &mut Self) -> Result<V, Error>
where
    V: Primitive
fn read_as<F, V>(self: &mut Self) -> Result<V, Error>
where
    F: Endianness,
    V: Primitive
fn read_bytes(self: &mut Self, buf: &mut [u8]) -> Result<()>
fn skip(self: &mut Self, bytes: u32) -> Result<()>
fn reader_ref(self: &mut Self) -> &mut dyn Read

impl<T> Any for ByteReader<R, E>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ByteReader<R, E>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ByteReader<R, E>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for ByteReader<R, E>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for ByteReader<R, E>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for ByteReader<R, E>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for ByteReader<R, E>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>