Library
Module
Module type
Parameter
Class
Class type
Serialization is done by converting CBOR data items to a sequence of signals. Signals can be directly translated to and from bytes. This module provides direct access to signals. This can be used to stream large CBOR data items and also provides the ability to work with indefinite-length CBOR data items.
type t =
| Null
| Undefined
| Bool of bool
| Integer of Z.t
The integer value must fit into 8 bytes.
*)| ByteString of int
In a well-formed sequence of signals, a ByteString n
element is always followed by exactly n
Byte b
elements.
| TextString of int
In a well-formed sequence of signals, a TextString n
element is always followed by exactly n
Byte b
elements.
| Byte of char
| Array of int option
In a well-formed sequence of signals, an Array n_opt
element is followed by exaclty n
well-formed sequence of CBOR items when n_opt = Some n
or by an indefinite number of items followed by a Break
element.
| Break
| Map of int option
In a well-formed sequence of signals, an Map n_opt
element is followed by exaclty n
well-formed sequence of CBOR items when n_opt = Some n
or by an indefinite number of items followed by a Break
element.
| Tag of Z.t
In a well-formed sequence of signals, a Tag t
element is followed by a single sequence of an encoded CBOR item.
| Simple of int
| Float of float
| Double of float
Type of CBOR Signal
Exception that is thrown when sequence of signals or encoding is not well formed.
of_item item
returns a sequence of signals that represents the CBOR data item item
.
Note that Cborl.Integer n
values are encoded as Bignums if n
is larger than what can be encoded in 8 bytes.
to_items signals
reads multiple CBOR data items from the sequence signals
.
to_item signals
reads one item from the sequence signals
and returns the sequence containing the continuation of signals after the read item.
indefinite_length_array items
returns a sequence of signals encoding items
as an indefinite-length array.
indefinite_length_array key_values
returns a sequence of signals encoding key_values
as an indefinite-length map.