pub trait Read {
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, ParseError>;

    fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ParseError> { ... }
    fn read_u64(&mut self) -> Result<u64, ParseError> { ... }
    fn read_u32(&mut self) -> Result<u32, ParseError> { ... }
    fn read_u16(&mut self) -> Result<u16, ParseError> { ... }
    fn read_u8(&mut self) -> Result<u8, ParseError> { ... }
    fn read_i64(&mut self) -> Result<i64, ParseError> { ... }
    fn read_i32(&mut self) -> Result<i32, ParseError> { ... }
    fn read_i16(&mut self) -> Result<i16, ParseError> { ... }
    fn read_i8(&mut self) -> Result<i8, ParseError> { ... }
    fn read_array<const N: usize>(&mut self) -> Result<[u8; N], ParseError> { ... }
}
Expand description

The Read trait provides a means of reading from byte streams.

Required Methods

Read a number of bytes into the provided buffer. The returned value is Ok(n) if a read was successful, and n bytes were read (n could be 0).

Provided Methods

Read exactly the required number of bytes. If not enough bytes could be read the function returns Err(_), and the contents of the given buffer is unspecified.

Read a u64 in little-endian format.

Read a u32 in little-endian format.

Read a u16 in little-endian format.

Read a u8.

Read a i64 in little-endian format.

Read a i32 in little-endian format.

Read a i16 in little-endian format.

Read a i32 in little-endian format.

Load an array of the given size.

Implementors