pub fn deserialize<T: DeserializeOwned>(
bytes: &[u8],
) -> Result<T, CachekitError>Expand description
Deserialize an interop-mode MessagePack document, consuming exactly one document and rejecting trailing bytes (spec MUST).
rmp_serde::from_slice silently ignores trailing bytes. That leniency is
dangerous here: a Python-SDK-internal CK frame begins 0x43 ('C'), which
is a complete one-byte MessagePack document (positive fixint 67) — a
lenient reader would silently decode an entire CK frame as the integer 67.
A payload with the 0x43 0x4B ("CK") prefix gets a specific diagnostic
naming the Python auto-mode frame instead of a generic trailing-bytes error.
§Errors
CachekitError::Serialization if the payload is a CK frame, is not valid
MessagePack, or has trailing bytes after the first document.