pub fn parse<'a>(
cap_zip: &'a [u8],
infl: &mut InflateCtx,
) -> Result<CapFile<'a>, CapError>Expand description
Parse a .cap (ZIP) byte buffer. Borrows cap_zip for the returned
CapFile’s lifetime. STORED and DEFLATE entries are both accepted.
infl is the caller-lent 32 KiB inflate context: parse uses it to
decompress the (small) Header/Import/Applet metadata components when they
are DEFLATE-encoded, so the same buffer later serves CapFile::lfdb
streaming — no second large allocation. It is left reset on return.
§Errors
Returns CapError::NotAZip if cap_zip is not a ZIP,
CapError::MissingComponent / CapError::Malformed for a structurally
invalid CAP, or CapError::Inflate if a DEFLATE metadata component cannot
be decompressed.