package orsetto
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=151ca6df499bd3de7aa89a4e1627411fbee24c4dea6e0e71ce21f06f181ee654
md5=00393728b481c2bf15919a8202732335
doc/orsetto.cbor/Cbor_event/index.html
Module Cbor_event
Concise Binary Object Representation (CBOR) events.
Overview
As defined in RFC 7049, a CBOR object is an octet sequence encoding a series of core events that correspond to a simple grammar describing the composition of structured data.
This module provides a safe interface for constructing valid CBOR events used by the encoder in
bor_encode
and the decoder in
bor_decode
.
Types
The type of indefinite-length sequencing signals.
The type of IEEE-754 floating point number precision.
The private type of CBOR minor codepoints. This is conceptually an unsigned 64-bit integer, encapsulated here in a private data constructor because the OCaml int64 type is a signed integer.
Constructors
val int_to_minor : int -> minorUse int_to_minor n to make a CBOR minor codepoint of value n. Raises Invalid_argument if n is negative.
val int64_to_minor : int64 -> minorUse int64_to_minor n to make a CBOR minor codepoint of value n. Raises Invalid_argument if n is negative.
val minor_to_intopt : minor -> int optionUse minor_to_intopt minor to extract the positive integer corresponding to minor. Returns None if the codepoint cannot be represented by the OCaml integer type.
val null : tThe distinguished "null" value.
val boolean : bool -> tUse boolean b to select either the distinguished "true" or "false" event according to b.
Use integer sign minor to make a positive or negative integer event, according to sign, with the value minor.
val float : ?p:ieee754_precision -> float -> tUse float n to make an IEEE 754 floating point number event with n. If ~p is not used, then the most precise form required to represent n without loss is selected.
val octets : string -> tUse octets s to make a definite length octet sequence event comprising the octets in s. To make an indefinite length octet sequence event, use the signal `Octets constructor.
val text : string -> tUse text s to make a definite length Unicode text sequence event comprising the UTF-8 encoded octets in s. If the octets in s do not comprise a valid UTF-8 encoding, then Cf_decode.Invalid is raised with the position of the invalid octet in s. To make an indefinite length Unicode text event, use the signal `Text constructor.
Use array minor to make an event signaling the start of a definite length array with the length indicated by minor. To make an indefinite length array event, use the signal `Array constructor.
Use map minor to make an event signaling the start of a definite length map with the length indicated by minor. To make an indefinite length map event, use the signal `Map constructor.
Utilities
Equivalence relation
include Cf_relations.Equal with type t := t
val force_precision : [< ieee754_precision ] -> float -> floatUse force_precision p n to truncate n for the precision p.