package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=9b654edb663ae697563f150824047052f3b1bf760398f24bce6350553f031f73c46b6337239a1acd871e61238597ea92046809e3358290ff14d6ba671b449085
doc/orsetto.cbor/Cbor_encode/Opaque/index.html
Module Cbor_encode.Opaque
A submodule containing logic for encoding CBOR messages from values of type Cf_type.opaque
according to optional mode selectors.
val mode : ?strings:[< `Octets | `Text ] -> unit -> mode
Use mode ()
to create a mode selector record for the opaque value encoder. Use any of the various optional parameters to set a mode selector to other than its default value. The modes are as follows:
strings
: Controls how OCaml strings are encoded. The default is octets.
val value : ?mode:mode -> Cf_type.opaque -> unit t
Use value v
to create the CBOR encoding of the opaque value v
provided it was witnessed by a type valid for output. The following table describes the runtime type indications required for values emitted.
Scalars:
Cf_type.Unit
: nullCf_type.Bool
: booleanCf_type.Int
: integerCf_type.Int32
: integerCf_type.Int64
: integerCf_type.Float
: integerCf_type.String
: octets (or text if mode.strings = `Text)Ucs_type.Text
: text
Containers:
Cf_type.(Seq {i nym})
: arrayCf_type.(Seq (Pair ({i nym}, {i nym})))
: mapCbor_type.(Tag ({i nym}))
: tag
...and...
Cf_type.Opaque
: any of the above
Use the ~mode
parameter to select modes other than the default.
Raises Invalid_argument
if the witnessed type is not valid for output as a CBOR value.
val model : mode -> Cf_type.opaque Cf_data_render.model
Use model mode
to make a modified primitive data render model for opaque values that uses mode
to control its output formatting.