type t = id
include Core_kernel.Bin_prot.Binable.S with type t := t
include Core_kernel.Bin_prot.Binable.S_only_functions with type t := t
This function only needs implementation if
t exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant
val bin_shape_t : Bin_prot.Shape.t
include Regular.Std.Printable.S with type t := t
val to_string : t -> string
to_string x returns a human-readable representation of
val str : unit -> t -> string
str () t is formatted output function that matches "%a" conversion format specifier in functions, that prints to string, e.g.,
errorf and, surprisingly all
Lwt printing function, including
Lwt_io.printf and logging (or any other function with type ('a,unit,string,...) formatN`. Example:
Or_error.errorf "type %a is not valid for %a" Type.str ty Exp.str exp
val pps : unit -> t -> string
will print to a standard
output_channel, useful for using in
prints a sequence of values of type
include Core_kernel.Comparable.S_binable with type t := t
include Base.Comparable.S with type t := t
include Base.Comparisons.S with type t := t
compare t1 t2 returns 0 if
t1 is equal to
t2, a negative integer if
t1 is less than
t2, and a positive integer if
t1 is greater than
ascending is identical to
descending x y = ascending y x. These are intended to be mnemonic when used like
List.sort ~compare:ascending and
~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.
clamp_exn t ~min ~max returns
t', the closest value to
t such that
between t' ~low:min ~high:max is true.
not (min <= max).
include Core_kernel.Hashable.S_binable with type t := t
include Regular.Std.Data.S with type t := t
name,Ver v,desc information attached to a particular reader or writer.
Data representation version. After any change in data representation the version should be increased.
Serializers that are derived from a data representation must have the same version as a version of the data structure, from which it is derived. This kind of serializers can only read and write data of the same version.
Other serializers can actually read and write data independent on its representation version. A serializer, that can't store data of current version simply shouldn't be added to a set of serializers.
It is assumed, that if a reader and a writer has the same name and version, then whatever was written by the writer should be readable by the reader. The round-trip equality is not required, thus it is acceptable if some information is lost.
It is also possible, that a reader and a writer that has the same name are compatible. In that case it is recommended to use semantic versioning.
val size_in_bytes : ?ver:string -> ?fmt:string -> t -> int
size_in_bytes ?ver ?fmt datum returns the amount of bytes that is needed to represent
datum in the given format and version
of_bytes ?ver ?fmt bytes deserializes a value from bytes.
to_bytes ?ver ?fmt datum serializes a
datum to a sequence of bytes.
blit_to_bytes ?ver ?fmt buffer datum offset copies a serialized representation of datum into a
buffer, starting from the