Skip to main content

encode_cnb

Function encode_cnb 

Source
pub fn encode_cnb<K: BlobKind>(
    validity: u32,
    meta: &K,
    payload: &[u8],
) -> Result<Vec<u8>, BlobError>
Expand description

Encode a blob image: the 16-byte header, the postcard-serialized metadata block, then the raw payload section.

The header’s magic comes from K, so the bytes declare which kind of container they are.

validity is the token stamped into the header and required to match on parse. What it means belongs to the kind: for the cooked world’s BlobMeta it is a schema version, and runtime callers pass concinnity_core::SCHEMA_VERSION.