Trait untrustended::ReaderExt [] [src]

pub trait ReaderExt {
    fn read_byte(&mut self) -> Result<u8, EndOfInput>;

    fn read_u8(&mut self) -> Result<u8, Error> { ... }
fn read_u16be(&mut self) -> Result<u16, Error> { ... }
fn read_u32be(&mut self) -> Result<u32, Error> { ... }
fn read_u64be(&mut self) -> Result<u64, Error> { ... }
fn read_u16le(&mut self) -> Result<u16, Error> { ... }
fn read_u32le(&mut self) -> Result<u32, Error> { ... }
fn read_u64le(&mut self) -> Result<u64, Error> { ... }
fn read_i16be(&mut self) -> Result<i16, Error> { ... }
fn read_i32be(&mut self) -> Result<i32, Error> { ... }
fn read_i64be(&mut self) -> Result<i64, Error> { ... }
fn read_i16le(&mut self) -> Result<i16, Error> { ... }
fn read_i32le(&mut self) -> Result<i32, Error> { ... }
fn read_i64le(&mut self) -> Result<i64, Error> { ... }
fn read_bytes(&mut self, length: usize) -> Result<Vec<u8>, Error> { ... }
fn read_utf8(&mut self, length: usize) -> Result<String, Error> { ... }
fn read_utf16(&mut self, length: usize) -> Result<String, Error> { ... }
fn read_ipv4addr(&mut self) -> Result<Ipv4Addr, Error> { ... }
fn read_ipv6addr(&mut self) -> Result<Ipv6Addr, Error> { ... } }

A trait extending untrusted's Reader.

Required Methods

Read one byte. This is the basic building block of every other read method provided.

Provided Methods

Reads 8 bit unsigned integer. Same as read_byte.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader is at the end of the input.

Reads 16 bit unsigned integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 32 bit unsigned integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 64 bit unsigned integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 16 bit unsigned integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 32 bit unsigned integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 64 bit unsigned integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 16 bit signed integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 32 bit signed integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 64 bit signed integer in big endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 16 bit signed integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 32 bit signed integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads 64 bit signed integer in little endian.

Returns Ok(v) where v is the value read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads given amount of bytes.

Returns Ok(v) where v is a Vec<u8> of bytes read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading.

Reads bytes as UTF-8 String.

Length is the amount of bytes to read, not the amount of UTF-8 characters.

Read bytes are validated to be valid UTF-8 by String::from_utf8 method.

Returns Ok(v) where v is a String of bytes read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading, or Err(Error::ParseError) if UTF-8 parsing failed.

Reads bytes as UTF-16 String.

Length is the amount of bytes to read, not the amount of UTF-16 characters. Length should be even number and Err(Error::ParseError) is returned if it's odd.

Read bytes are validated to be valid UTF-16 by String::from_utf16 method.

Returns Ok(v) where v is a String of bytes read, or Err(Error::EndOfInput) if the Reader encountered an end of the input while reading, or Err(Error::ParseError) if UTF-8 parsing failed.

Reads IPv4 address in big endian format.

Reads IPv6 address in big endian format.

Implementors