pub trait DataStream: Send + Sync {
// Required methods
fn get_size(&mut self) -> Result<u64, ErrorTrace>;
fn read(&mut self, buf: &mut [u8]) -> Result<usize, ErrorTrace>;
fn seek(&mut self, pos: SeekFrom) -> Result<u64, ErrorTrace>;
// Provided methods
fn read_at_position(
&mut self,
buf: &mut [u8],
pos: SeekFrom,
) -> Result<usize, ErrorTrace> { ... }
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ErrorTrace> { ... }
fn read_exact_at_position(
&mut self,
buf: &mut [u8],
pos: SeekFrom,
) -> Result<u64, ErrorTrace> { ... }
}Expand description
Data stream trait.
Required Methods§
Sourcefn get_size(&mut self) -> Result<u64, ErrorTrace>
fn get_size(&mut self) -> Result<u64, ErrorTrace>
Retrieves the size of the data.
Provided Methods§
Sourcefn read_at_position(
&mut self,
buf: &mut [u8],
pos: SeekFrom,
) -> Result<usize, ErrorTrace>
fn read_at_position( &mut self, buf: &mut [u8], pos: SeekFrom, ) -> Result<usize, ErrorTrace>
Reads data at a specific position.
Sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ErrorTrace>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ErrorTrace>
Reads an exact amount of data at the current position.
Sourcefn read_exact_at_position(
&mut self,
buf: &mut [u8],
pos: SeekFrom,
) -> Result<u64, ErrorTrace>
fn read_exact_at_position( &mut self, buf: &mut [u8], pos: SeekFrom, ) -> Result<u64, ErrorTrace>
Reads an exact amount of data at a specific position.