Skip to main content

decode_chunk

Function decode_chunk 

Source
pub fn decode_chunk(
    data: &[u8],
    n_workers: usize,
    is_last: bool,
) -> Result<(Vec<Vec<u8>>, usize), ZipError>
Expand description

Decode a full chunk in parallel.

  1. Split the chunk at full-flush boundaries (Nāˆ’1 rayon tasks).
  2. If no boundaries found, fall back: returns Err with a sentinel so the caller can decompress the chunk single-core.
  3. Otherwise decode decode_segments segments in parallel via rayon.

Returns (segment_outputs, consumed_bytes). consumed_bytes is the byte offset up to which the chunk was decoded — bytes from consumed_bytes.. must be carried into the next slot.