Skip to main content

decompress_entry_cow

Function decompress_entry_cow 

Source
pub fn decompress_entry_cow<'a>(
    data: &'a [u8],
    loc: &EntryLocation,
) -> Result<Cow<'a, [u8]>, ZipError>
Expand description

Borrowing decode: same as decompress_entry but returns Cow so that STORE entries (method 0) borrow directly from data instead of copying.

The returned Cow::Borrowed aliases the input slice, so the caller must keep data alive for the lifetime of the result (true for the in-memory parallel/batch paths where the source buffer outlives the call). Avoids the .to_vec() clone of already-stored bytes (.png, nested .jar, .so) — Law 1.