package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=151ca6df499bd3de7aa89a4e1627411fbee24c4dea6e0e71ce21f06f181ee654
md5=00393728b481c2bf15919a8202732335
doc/orsetto.cbor/Cbor_encode/index.html
Module Cbor_encode
Concise Binary Object Representation (CBOR) event and value encoders.
Overview
This module provides a
f_encode
scheme for CBOR events, and a system of schemes for emitting CBOR values as octet streams.
Events
val event : Cbor_event.t Cf_encode.scheme
The CBOR event encoder scheme. This scheme can encode most valid CBOR encodings.
Values
type t = private unit Cf_encode.Monad.t
The type of a CBOR event sequence encoding a value.
val null : t
The CBOR encoding of the null value.
val boolean : bool -> t
Use boolean b
to make the CBOR encoding of b
.
val integer : int -> t
Use integer n
to make the CBOR encoding of the integer value n
.
val float : ?p:Cbor_event.ieee754_precision -> float -> t
Use float ?p n
to make the CBOR encoding of the floating point value n
. If ~p
is not provided, then the most precise form required to represent n
without loss is selected.
val octets : string -> t
Use octets s
to make the CBOR encoding of the octet sequence s
.
val text : Ucs_text.t -> t
Use text s
to make the CBOR encoding of the Unicode text s
.
Use map v
to make the CBOR encoding of the map containing the key-value pairs in v
.
Indefinite length sequences
Use octets_seq s
to make the CBOR encoding of the indefinite length octet sequence comprising the strings in s
.
val text_seq : Ucs_text.t Seq.t -> t
Use text_seq s
to make the CBOR encoding of the indefinite length Unicode text comprising the concatenation of the UTF-8 encoded fragments in s
.
Use array_seq s
to make the CBOR encoding of the indefinite length array comprising the elements encoded in s
.
Use map_seq s
to make the CBOR encoding of the indefinite length map comprising the key-value pairs encoded in s
.
Value Schemes
val scheme : ('v -> t) -> 'v Cf_encode.scheme
Use scheme f
to make the encoding scheme that applies f
to the emitted value to obtain the encoding of the sequence of CBOR events comprising its encoding.
Conveniences
val to_string : t -> string
Use to_string v
to make a string comprising the encoding of v
.