This module provides flyweight encoding and decoding of Concise Binary Object Representation (CBOR) structured data.
Use the flyweight implementation when values are not very large, streaming is not required, integer and floating point values do not exceed the limits of representation for OCaml primitive int and float types, lengths of octet arrays and Unicode texts do not exceed the limits of the OCaml string type, no special handling is required for standard CBOR tags, no Unicode normalization is required, and the order/uniqueness properties of key-value pairs in maps is not required to be canonical.
The encoder never emits indefinite-length sequence events. The decoder can scan them and reconstruct fixed-length sequences from them accordingly.
The functions below guard construction of flyweight values to respect the invariants of the CBOR encoding, e.g. tag values must be non-negative integers, text strings should comprise valid UTF-8 encodings, an "undefined" value can only be constructed by decoders, et cetera.