claxon::input

Struct BufferedReader

Source
pub struct BufferedReader<R: Read> { /* private fields */ }
Expand description

Similar to std::io::BufRead, but more performant.

There is no simple way to wrap a standard BufRead such that it can compute checksums on consume. This is really something that needs a less restrictive interface. Apart from enabling checksum computations, this buffered reader has some convenience functions.

Implementations§

Source§

impl<R: Read> BufferedReader<R>

Source

pub fn new(inner: R) -> BufferedReader<R>

Wrap the reader in a new buffered reader.

Source

pub fn into_inner(self) -> R

Destroys the buffered reader, returning the wrapped reader.

Anything in the buffer will be lost.

Trait Implementations§

Source§

impl<R: Read> ReadBytes for BufferedReader<R>

Source§

fn read_u8(&mut self) -> Result<u8>

Reads a single byte, failing on EOF.
Source§

fn read_u8_or_eof(&mut self) -> Result<Option<u8>>

Reads a single byte, not failing on EOF.
Source§

fn read_into(&mut self, buffer: &mut [u8]) -> Result<()>

Reads until the provided buffer is full.
Source§

fn skip(&mut self, amount: u32) -> Result<()>

Skips over the specified number of bytes. Read more
Source§

fn read_be_u16(&mut self) -> Result<u16>

Reads two bytes and interprets them as a big-endian 16-bit unsigned integer.
Source§

fn read_be_u16_or_eof(&mut self) -> Result<Option<u16>>

Reads two bytes and interprets them as a big-endian 16-bit unsigned integer.
Source§

fn read_be_u24(&mut self) -> Result<u32>

Reads three bytes and interprets them as a big-endian 24-bit unsigned integer.
Source§

fn read_be_u32(&mut self) -> Result<u32>

Reads four bytes and interprets them as a big-endian 32-bit unsigned integer.
Source§

fn read_le_u32(&mut self) -> Result<u32>

Reads four bytes and interprets them as a little-endian 32-bit unsigned integer.

Auto Trait Implementations§

§

impl<R> Freeze for BufferedReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for BufferedReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for BufferedReader<R>
where R: Send,

§

impl<R> Sync for BufferedReader<R>
where R: Sync,

§

impl<R> Unpin for BufferedReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for BufferedReader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.