Trait ReadBytes
pub trait ReadBytes {
Show 34 methods
// Required methods
fn read_byte(&mut self) -> Result<u8, Error> ⓘ;
fn read_double_bytes(&mut self) -> Result<[u8; 2], Error> ⓘ;
fn read_triple_bytes(&mut self) -> Result<[u8; 3], Error> ⓘ;
fn read_quad_bytes(&mut self) -> Result<[u8; 4], Error> ⓘ;
fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize, Error> ⓘ;
fn read_buf_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> ⓘ;
fn scan_bytes_aligned<'a>(
&mut self,
pattern: &[u8],
align: usize,
buf: &'a mut [u8],
) -> Result<&'a mut [u8], Error> ⓘ;
fn ignore_bytes(&mut self, count: u64) -> Result<(), Error> ⓘ;
fn pos(&self) -> u64 ⓘ;
// Provided methods
fn read_u8(&mut self) -> Result<u8, Error> ⓘ { ... }
fn read_i8(&mut self) -> Result<i8, Error> ⓘ { ... }
fn read_u16(&mut self) -> Result<u16, Error> ⓘ { ... }
fn read_i16(&mut self) -> Result<i16, Error> ⓘ { ... }
fn read_be_u16(&mut self) -> Result<u16, Error> ⓘ { ... }
fn read_be_i16(&mut self) -> Result<i16, Error> ⓘ { ... }
fn read_u24(&mut self) -> Result<u32, Error> ⓘ { ... }
fn read_i24(&mut self) -> Result<i32, Error> ⓘ { ... }
fn read_be_u24(&mut self) -> Result<u32, Error> ⓘ { ... }
fn read_be_i24(&mut self) -> Result<i32, Error> ⓘ { ... }
fn read_u32(&mut self) -> Result<u32, Error> ⓘ { ... }
fn read_i32(&mut self) -> Result<i32, Error> ⓘ { ... }
fn read_be_u32(&mut self) -> Result<u32, Error> ⓘ { ... }
fn read_be_i32(&mut self) -> Result<i32, Error> ⓘ { ... }
fn read_u64(&mut self) -> Result<u64, Error> ⓘ { ... }
fn read_i64(&mut self) -> Result<i64, Error> ⓘ { ... }
fn read_be_u64(&mut self) -> Result<u64, Error> ⓘ { ... }
fn read_be_i64(&mut self) -> Result<i64, Error> ⓘ { ... }
fn read_f32(&mut self) -> Result<f32, Error> ⓘ { ... }
fn read_be_f32(&mut self) -> Result<f32, Error> ⓘ { ... }
fn read_f64(&mut self) -> Result<f64, Error> ⓘ { ... }
fn read_be_f64(&mut self) -> Result<f64, Error> ⓘ { ... }
fn read_boxed_slice(&mut self, len: usize) -> Result<Box<[u8]>, Error> ⓘ { ... }
fn read_boxed_slice_exact(&mut self, len: usize) -> Result<Box<[u8]>, Error> ⓘ { ... }
fn scan_bytes<'a>(
&mut self,
pattern: &[u8],
buf: &'a mut [u8],
) -> Result<&'a mut [u8], Error> ⓘ { ... }
}
dep_symphonia
only.Expand description
ReadBytes
provides methods to read bytes and interpret them as little- or big-endian
unsigned integers or floating-point values of standard widths.
Required Methods§
fn read_byte(&mut self) -> Result<u8, Error> ⓘ
fn read_byte(&mut self) -> Result<u8, Error> ⓘ
Reads a single byte from the stream and returns it or an error.
fn read_double_bytes(&mut self) -> Result<[u8; 2], Error> ⓘ
fn read_double_bytes(&mut self) -> Result<[u8; 2], Error> ⓘ
Reads two bytes from the stream and returns them in read-order or an error.
fn read_triple_bytes(&mut self) -> Result<[u8; 3], Error> ⓘ
fn read_triple_bytes(&mut self) -> Result<[u8; 3], Error> ⓘ
Reads three bytes from the stream and returns them in read-order or an error.
fn read_quad_bytes(&mut self) -> Result<[u8; 4], Error> ⓘ
fn read_quad_bytes(&mut self) -> Result<[u8; 4], Error> ⓘ
Reads four bytes from the stream and returns them in read-order or an error.
fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize, Error> ⓘ
fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize, Error> ⓘ
Reads up-to the number of bytes required to fill buf or returns an error.
fn read_buf_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> ⓘ
fn read_buf_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> ⓘ
Reads exactly the number of bytes required to fill be provided buffer or returns an error.
fn scan_bytes_aligned<'a>(
&mut self,
pattern: &[u8],
align: usize,
buf: &'a mut [u8],
) -> Result<&'a mut [u8], Error> ⓘ
fn scan_bytes_aligned<'a>( &mut self, pattern: &[u8], align: usize, buf: &'a mut [u8], ) -> Result<&'a mut [u8], Error> ⓘ
Reads bytes from a stream into a supplied buffer until a byte patter is matched on an aligned byte boundary. Returns a mutable slice to the valid region of the provided buffer.
Provided Methods§
fn read_u8(&mut self) -> Result<u8, Error> ⓘ
fn read_u8(&mut self) -> Result<u8, Error> ⓘ
Reads a single unsigned byte from the stream and returns it or an error.
fn read_i8(&mut self) -> Result<i8, Error> ⓘ
fn read_i8(&mut self) -> Result<i8, Error> ⓘ
Reads a single signed byte from the stream and returns it or an error.
fn read_u16(&mut self) -> Result<u16, Error> ⓘ
fn read_u16(&mut self) -> Result<u16, Error> ⓘ
Reads two bytes from the stream and interprets them as an unsigned 16-bit little-endian integer or returns an error.
fn read_i16(&mut self) -> Result<i16, Error> ⓘ
fn read_i16(&mut self) -> Result<i16, Error> ⓘ
Reads two bytes from the stream and interprets them as an signed 16-bit little-endian integer or returns an error.
fn read_be_u16(&mut self) -> Result<u16, Error> ⓘ
fn read_be_u16(&mut self) -> Result<u16, Error> ⓘ
Reads two bytes from the stream and interprets them as an unsigned 16-bit big-endian integer or returns an error.
fn read_be_i16(&mut self) -> Result<i16, Error> ⓘ
fn read_be_i16(&mut self) -> Result<i16, Error> ⓘ
Reads two bytes from the stream and interprets them as an signed 16-bit big-endian integer or returns an error.
fn read_u24(&mut self) -> Result<u32, Error> ⓘ
fn read_u24(&mut self) -> Result<u32, Error> ⓘ
Reads three bytes from the stream and interprets them as an unsigned 24-bit little-endian integer or returns an error.
fn read_i24(&mut self) -> Result<i32, Error> ⓘ
fn read_i24(&mut self) -> Result<i32, Error> ⓘ
Reads three bytes from the stream and interprets them as an signed 24-bit little-endian integer or returns an error.
fn read_be_u24(&mut self) -> Result<u32, Error> ⓘ
fn read_be_u24(&mut self) -> Result<u32, Error> ⓘ
Reads three bytes from the stream and interprets them as an unsigned 24-bit big-endian integer or returns an error.
fn read_be_i24(&mut self) -> Result<i32, Error> ⓘ
fn read_be_i24(&mut self) -> Result<i32, Error> ⓘ
Reads three bytes from the stream and interprets them as an signed 24-bit big-endian integer or returns an error.
fn read_u32(&mut self) -> Result<u32, Error> ⓘ
fn read_u32(&mut self) -> Result<u32, Error> ⓘ
Reads four bytes from the stream and interprets them as an unsigned 32-bit little-endian integer or returns an error.
fn read_i32(&mut self) -> Result<i32, Error> ⓘ
fn read_i32(&mut self) -> Result<i32, Error> ⓘ
Reads four bytes from the stream and interprets them as an signed 32-bit little-endian integer or returns an error.
fn read_be_u32(&mut self) -> Result<u32, Error> ⓘ
fn read_be_u32(&mut self) -> Result<u32, Error> ⓘ
Reads four bytes from the stream and interprets them as an unsigned 32-bit big-endian integer or returns an error.
fn read_be_i32(&mut self) -> Result<i32, Error> ⓘ
fn read_be_i32(&mut self) -> Result<i32, Error> ⓘ
Reads four bytes from the stream and interprets them as a signed 32-bit big-endian integer or returns an error.
fn read_u64(&mut self) -> Result<u64, Error> ⓘ
fn read_u64(&mut self) -> Result<u64, Error> ⓘ
Reads eight bytes from the stream and interprets them as an unsigned 64-bit little-endian integer or returns an error.
fn read_i64(&mut self) -> Result<i64, Error> ⓘ
fn read_i64(&mut self) -> Result<i64, Error> ⓘ
Reads eight bytes from the stream and interprets them as an signed 64-bit little-endian integer or returns an error.
fn read_be_u64(&mut self) -> Result<u64, Error> ⓘ
fn read_be_u64(&mut self) -> Result<u64, Error> ⓘ
Reads eight bytes from the stream and interprets them as an unsigned 64-bit big-endian integer or returns an error.
fn read_be_i64(&mut self) -> Result<i64, Error> ⓘ
fn read_be_i64(&mut self) -> Result<i64, Error> ⓘ
Reads eight bytes from the stream and interprets them as an signed 64-bit big-endian integer or returns an error.
fn read_f32(&mut self) -> Result<f32, Error> ⓘ
fn read_f32(&mut self) -> Result<f32, Error> ⓘ
Reads four bytes from the stream and interprets them as a 32-bit little-endian IEEE-754 floating-point value.
fn read_be_f32(&mut self) -> Result<f32, Error> ⓘ
fn read_be_f32(&mut self) -> Result<f32, Error> ⓘ
Reads four bytes from the stream and interprets them as a 32-bit big-endian IEEE-754 floating-point value.
fn read_f64(&mut self) -> Result<f64, Error> ⓘ
fn read_f64(&mut self) -> Result<f64, Error> ⓘ
Reads four bytes from the stream and interprets them as a 64-bit little-endian IEEE-754 floating-point value.
fn read_be_f64(&mut self) -> Result<f64, Error> ⓘ
fn read_be_f64(&mut self) -> Result<f64, Error> ⓘ
Reads four bytes from the stream and interprets them as a 64-bit big-endian IEEE-754 floating-point value.
fn read_boxed_slice(&mut self, len: usize) -> Result<Box<[u8]>, Error> ⓘ
fn read_boxed_slice(&mut self, len: usize) -> Result<Box<[u8]>, Error> ⓘ
Reads up-to the number of bytes requested, and returns a boxed slice of the data or an error.