Module Core_kernel.Binable

Module types and utilities for dealing with types that support the bin-io binary encoding.

type bigstring = (Core_kernel__.Import.char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

We copy the definition of the bigstring type here, because we cannot depend on bigstring.ml

module type S = Bin_prot.Binable.S

New code should use @@deriving bin_io. These module types (S, S1, and S2) are exported only for backwards compatibility.

module type S_only_functions = Bin_prot.Binable.S_only_functions
module type S1 = Bin_prot.Binable.S1
module type S2 = Bin_prot.Binable.S2
module type S3 = Bin_prot.Binable.S3
module Minimal : sig ... end
module Of_binable : functor (Binable : Minimal.S) -> functor (M : sig ... end) -> S with type t := M.t
module Of_binable1 : functor (Binable : Minimal.S1) -> functor (M : sig ... end) -> S1 with type 'a t := 'a M.t
module Of_binable2 : functor (Binable : Minimal.S2) -> functor (M : sig ... end) -> S2 with type ('a, 'b) t := ('a'b) M.t
module Of_binable3 : functor (Binable : Minimal.S3) -> functor (M : sig ... end) -> S3 with type ('a, 'b, 'c) t := ('a'b'c) M.t
module Of_sexpable : functor (M : Sexpable.S) -> S with type t := M.t

Of_sexpable serializes a value using the bin-io of the sexp serialization of the value. This is not as efficient as using @@deriving bin_io. However, it is useful when performance isn't important and there are obstacles to using @@deriving bin_io, e.g., some type missing @@deriving bin_io. Of_sexpable is also useful when one wants to be forgiving about format changes, due to the sexp serialization being more robust to changes like adding or removing a constructor.

module Of_stringable : functor (M : Core_kernel__.Import.Stringable.S) -> S with type t := M.t
type 'a m = (module S with type t = 'a)
val of_bigstring : 'a m -> bigstring -> 'a
val to_bigstring : ?⁠prefix_with_length:Core_kernel__.Import.bool -> 'a m -> 'a -> bigstring
val of_string : 'a m -> Core_kernel__.Import.string -> 'a
val to_string : 'a m -> 'a -> Core_kernel__.Import.string
module Stable : sig ... end