Skip to main content

structural_value

Function structural_value 

Source
pub fn structural_value(bytes: &[u8]) -> Option<Value>
Available on crate feature decode only.
Expand description

The structural sniff as a value rather than as text — the same ladder structural renders, stopped one step earlier.

Some means the bytes carry a self-describing document (JSON, or CBOR that accounts for every byte and is not the text-vs-scalar ambiguity below). None means they do not: plain text, or opaque bytes. That distinction is what lets a caller diff two payloads field-by-field when it can, and say so honestly — a byte comparison — when it cannot.

Deliberately sync and schema-free: this runs on render paths, where the async decode_sample (which may GET a describe on a miss) must never sit.