Skip to main content

serialize_value

Function serialize_value 

Source
pub fn serialize_value(value: &InteropValue) -> Result<Vec<u8>, CachekitError>
Expand description

Encode a single value to canonical MessagePack (value profile: floats are not collapsed โ€” a float value 2.0 stays float64 so it round-trips as a float).

Interop values are plain MessagePack, so any serde-serialized document is also a valid interop value; use this function when byte-canonical output (sorted map keys, shortest forms) is required, e.g. to match the published value vectors.

ยงErrors

CachekitError::Serialization for out-of-model values, and for InteropValue::DateTime โ€” temporal values use the wire-format sentinel map ({"__datetime__": true, "value": "<ISO-8601>"}), not the argument-hashing Unix-timestamp encoding; build the sentinel map explicitly.