package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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

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.

val array : t array -> t

Use array v to make the CBOR encoding of the array v.

val map : (t * t) array -> t

Use map v to make the CBOR encoding of the map containing the key-value pairs in v.

val tagged : int64 -> t -> t

Use tagged n v

Indefinite length sequences
val octets_seq : string Seq.t -> t

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.

val array_seq : t Seq.t -> t

Use array_seq s to make the CBOR encoding of the indefinite length array comprising the elements encoded in s.

val map_seq : (t * t) Seq.t -> t

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.