Skip to main content

decode_json_envelope

Function decode_json_envelope 

Source
pub fn decode_json_envelope<T: DeserializeOwned>(
    bytes: &[u8],
    supported_version: u32,
    classify_kind: impl FnOnce(&str) -> Result<(), EnvelopeCodecError>,
) -> Result<DecodedJsonEnvelope<T>, EnvelopeCodecError>
Expand description

Decodes one JSON-bodied envelope: probe first (kind through classify_kind, then version), then the checksum over the stored payload fragment, then the payload itself.

classify_kind lets a family with a kind registry report unknown kinds distinctly from mismatched ones; families with one kind pass verify_kind directly.