Private.Codec
Topkg interprocess communication codec.
Codecs for communication between the topkg
tool and topkg description files.
The type for decode errors.
Corrupted (kind, data)
, an error occured while decoding data
for kind
.Version (exp, fnd)
, a versioned decoder expected version exp
but found fnd
val pp_error : Format.formatter -> error -> unit
pp_error ppf e
prints an unspecified representation of e
on ppf
.
exception Error of error
Raised on decode errors.
val v : kind:string -> enc:('a -> string) -> dec:(string -> 'a) -> 'a t
v kind enc dec
is a codec for value identified as kind
using enc
to encode and dec
to decode.
val kind : 'a t -> string
kind c
is c
's kind.
val enc : 'a t -> 'a -> string
enc c
is c
's encoder.
val dec : 'a t -> string -> 'a
dec c
is c
's decoder. The decoder
val unit : unit t
unit
codecs a ()
.
val const : 'a -> 'a t
const v
codecs the constant v
.
val bool : bool t
bool
codecs booleans.
val int : int t
int
codecs integers.
val string : string t
string
codecs strings.
t5
is like pair
but for qintuples.
alt tag cs
codecs values by tagging them with tag
and using the corresponding codec in cs
.
version num c
versions codec c
with number num
. On decode a version number mismatch raises an error see error
.
view kind t c
views t
as c
for codecing.
val msg : [ `Msg of string ] t
msg
codecs error messages.