pub struct ChunkReader {
chunks: ChunkSet,
position: u64,
total_size: u64,
chunk_size: u64,
current_chunk_cache: usize,
}Expand description
Chunk reader for streaming ISO data
Fields§
§chunks: ChunkSetChunk information
position: u64Current read position (for sequential reads)
total_size: u64Total ISO size
chunk_size: u64Chunk size used during write
current_chunk_cache: usizeCached current chunk index (optimization)
Implementations§
Source§impl ChunkReader
impl ChunkReader
Sourcepub fn from_manifest(manifest: &IsoManifest) -> Result<Self, IsoError>
pub fn from_manifest(manifest: &IsoManifest) -> Result<Self, IsoError>
Create a reader from a manifest
Sourcepub fn from_chunks(chunks: ChunkSet, chunk_size: u64) -> Self
pub fn from_chunks(chunks: ChunkSet, chunk_size: u64) -> Self
Create a reader from a chunk set
Sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Get total ISO size
Sourcepub fn num_chunks(&self) -> usize
pub fn num_chunks(&self) -> usize
Get number of chunks
Sourcefn chunk_index_for_offset(&self, offset: u64) -> Option<usize>
fn chunk_index_for_offset(&self, offset: u64) -> Option<usize>
Find chunk containing a given byte offset
Sourcefn chunk_start_offset(&self, chunk_index: usize) -> u64
fn chunk_start_offset(&self, chunk_index: usize) -> u64
Get the starting byte offset of a chunk
Sourcepub fn read_at<F>(
&self,
offset: u64,
buffer: &mut [u8],
read_sector_fn: F,
) -> Result<usize, IsoError>
pub fn read_at<F>( &self, offset: u64, buffer: &mut [u8], read_sector_fn: F, ) -> Result<usize, IsoError>
Read data at a specific offset
The read_sector_fn callback performs the actual block I/O:
fn(partition_start_lba: u64, sector_offset: u64, buffer: &mut [u8]) -> Result<usize, IsoError>
Returns number of bytes read (may be less than buffer size at EOF or chunk boundary)
Sourcepub fn read_next<F>(
&mut self,
buffer: &mut [u8],
read_sector_fn: F,
) -> Result<usize, IsoError>
pub fn read_next<F>( &mut self, buffer: &mut [u8], read_sector_fn: F, ) -> Result<usize, IsoError>
Read at current position and advance
This is the main method for sequential reading.
Auto Trait Implementations§
impl Freeze for ChunkReader
impl RefUnwindSafe for ChunkReader
impl Send for ChunkReader
impl Sync for ChunkReader
impl Unpin for ChunkReader
impl UnwindSafe for ChunkReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more