[][src]Trait claxon::input::ReadBytes

pub trait ReadBytes {
    fn read_u8(&mut self) -> Result<u8>;
fn read_u8_or_eof(&mut self) -> Result<Option<u8>>;
fn read_into(&mut self, buffer: &mut [u8]) -> Result<()>;
fn skip(&mut self, amount: u32) -> Result<()>; fn read_be_u16(&mut self) -> Result<u16> { ... }
fn read_be_u16_or_eof(&mut self) -> Result<Option<u16>> { ... }
fn read_be_u24(&mut self) -> Result<u32> { ... }
fn read_be_u32(&mut self) -> Result<u32> { ... }
fn read_le_u32(&mut self) -> Result<u32> { ... } }

Provides convenience methods to make input less cumbersome.

Required methods

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

Reads a single byte, failing on EOF.

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

Reads a single byte, not failing on EOF.

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

Reads until the provided buffer is full.

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

Skips over the specified number of bytes.

For a buffered reader, this can help a lot by just bumping a pointer.

Loading content...

Provided methods

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

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

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.

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

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

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

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

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

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

Loading content...

Implementations on Foreign Types

impl<'r, R: ReadBytes> ReadBytes for &'r mut R[src]

impl<T: AsRef<[u8]>> ReadBytes for Cursor<T>[src]

Loading content...

Implementors

impl<R: Read> ReadBytes for BufferedReader<R>[src]

Loading content...