Skip to main content

decode

Function decode 

Source
pub fn decode(base: &[u8], stream: &[u8]) -> Result<Vec<u8>, MkitError>
Expand description

Apply a v1 delta stream to base, returning the reconstructed bytes. Verifies header version, base length, COPY bounds, and the final result_len.

§Errors

Returns MkitError::UnsupportedObjectVersion for stream version other than 0x01, MkitError::UnexpectedEof for truncated input, and MkitError::TrailingData for any other corruption (zero opcode, COPY past base, length mismatch at end-of-stream, reserved bits set, etc.).

§Panics

Slice-to-fixed-array conversions in this function are guarded by the preceding bounds checks; the expect calls trip only if the compiler’s slice-bounds elision is wrong.