cborrs::cbordet

Function cbor_det_parse

Source
pub fn cbor_det_parse<'a>(input: &'a [u8]) -> Option<(CborDet<'a>, &'a [u8])>
Expand description

Tries to parse a Deterministic CBOR object from the first bytes of input, following RFC 8949 Section 4.2.1, minus floating-point values. Returns None in case of failure, or Some(object, rem) in case of success, where rem is the remainder of the input slice past those first bytes of input that contain the valid binary representation of input. This function does not perform a deep parse of input, it only copies the object type, tag and/or size of the top-most object. As such, it uses constant stack space (including data validation.) “Destructor” functions are to be used on the returned object, to examine each level of nesting one at a time. NOTE: This implementation checks for the basic validity constraints of Section 5.3.1, i.e. the absence of duplicate map keys (which is a consequence of the deterministic encoding.), and the well-formedness of UTF-8 text strings.