Skip to main content

parse_cnb

Function parse_cnb 

Source
pub fn parse_cnb<K: BlobKind>(
    validity: u32,
    data: &[u8],
) -> Result<(K, usize), BlobError>
Expand description

Parse a blob image’s header and metadata block. Returns the metadata and the offset at which the payload section begins.

K decides both the magic the header must carry and the type the metadata block decodes into, so an image written for another kind is rejected as BlobError::BadMagic rather than decoded into the wrong shape.

validity is what the header’s token must equal for the image to be readable by this build. What it means belongs to the kind: for BlobMeta it is a schema version, and runtime callers pass concinnity_core::SCHEMA_VERSION.