Trait ByteRead
trait ByteRead
A trait for anything that can read aligned values from an input stream
Required Methods
fn read<V>(self: &mut Self) -> Result<V, Error> where V: PrimitiveReads whole numeric value from stream
Errors
Passes along any I/O error from the underlying stream.
Examples
use ; use ; let data = ; let mut reader = endian; assert_eq!;use ; use ; let data = ; let mut reader = endian; assert_eq!;fn read_as<F, V>(self: &mut Self) -> Result<V, Error> where F: Endianness, V: PrimitiveReads whole numeric value from stream in a potentially different endianness
Errors
Passes along any I/O error from the underlying stream.
Examples
use ; use ; let data = ; let mut reader = endian; assert_eq!;use ; use ; let data = ; let mut reader = endian; assert_eq!;fn skip(self: &mut Self, bytes: u32) -> Result<()>Skips the given number of bytes in the stream.
Errors
Passes along any I/O error from the underlying stream.
fn reader_ref(self: &mut Self) -> &mut dyn ReadReturns mutable reference to underlying reader
Provided Methods
fn read_bytes(self: &mut Self, buf: &mut [u8]) -> Result<()>Completely fills the given buffer with whole bytes.
Errors
Passes along any I/O error from the underlying stream.
fn read_to_bytes<SIZE: usize>(self: &mut Self) -> Result<[u8; SIZE]>Completely fills a whole buffer with bytes and returns it.
Errors
Passes along any I/O error from the underlying stream.
fn read_to_vec(self: &mut Self, bytes: usize) -> Result<Vec<u8>>Completely fills a vector of bytes and returns it.
Errors
Passes along any I/O error from the underlying stream.
fn parse<F: FromByteStream>(self: &mut Self) -> Result<F, <F as >::Error>Parses and returns complex type
fn parse_with<'a, F: FromByteStreamWith<'a>>(self: &mut Self, context: &<F as >::Context) -> Result<F, <F as >::Error>Parses and returns complex type with context
Implementors
impl<R: io::Read, E: Endianness> ByteRead for ByteReader<R, E>