package orsetto
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=f64814687276bad56483b2b8dfaaf70d0d6485f67fe5d44bff34bfa47af1896e
md5=3a15a377800cf988a310b4082406c685
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.schemeThe CBOR event encoder scheme. This scheme can encode most valid CBOR encodings.
Values
type t = private unit Cf_encode.Monad.tThe type of a CBOR event sequence encoding a value.
val null : tThe CBOR encoding of the null value.
val boolean : bool -> tUse boolean b to make the CBOR encoding of b.
val integer : int -> tUse integer n to make the CBOR encoding of the integer value n.
val float : ?p:Cbor_event.ieee754_precision -> float -> tUse 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 -> tUse octets s to make the CBOR encoding of the octet sequence s.
val text : Ucs_text.t -> tUse 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 -> tUse 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.schemeUse 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 -> stringUse to_string v to make a string comprising the encoding of v.