package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type bigstring = (Base.Char.t, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.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 type Conv = sig ... end
module type Conv1 = sig ... end
module type Conv2 = sig ... end
module type Conv3 = sig ... end
module type Conv_sexpable = sig ... end
module type Conv_stringable = sig ... end
module type Conv_without_uuid = sig ... end
module type Conv1_without_uuid = sig ... end
module type Conv2_without_uuid = sig ... end
module type Conv3_without_uuid = sig ... end

Of_binable* functors are for when you want the binary representation of one type to be the same as that for some other isomorphic type.

module Of_binable_with_uuid (Binable : Minimal.S) (M : Conv with type binable := Binable.t) : S with type t := M.t
module Of_binable1_with_uuid (Binable : Minimal.S1) (M : Conv1 with type 'a binable := 'a Binable.t) : S1 with type 'a t := 'a M.t
module Of_binable2_with_uuid (Binable : Minimal.S2) (M : Conv2 with type ('a, 'b) binable := ('a, 'b) Binable.t) : S2 with type ('a, 'b) t := ('a, 'b) M.t
module Of_binable3_with_uuid (Binable : Minimal.S3) (M : Conv3 with type ('a, 'b, 'c) binable := ('a, 'b, 'c) Binable.t) : S3 with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.t
module Of_binable_without_uuid (Binable : Minimal.S) (M : Conv_without_uuid with type binable := Binable.t) : S with type t := M.t
module Of_binable1_without_uuid (Binable : Minimal.S1) (M : Conv1_without_uuid with type 'a binable := 'a Binable.t) : S1 with type 'a t := 'a M.t
module Of_binable2_without_uuid (Binable : Minimal.S2) (M : Conv2_without_uuid with type ('a, 'b) binable := ('a, 'b) Binable.t) : S2 with type ('a, 'b) t := ('a, 'b) M.t
module Of_binable3_without_uuid (Binable : Minimal.S3) (M : Conv3_without_uuid with type ('a, 'b, 'c) binable := ('a, 'b, 'c) Binable.t) : S3 with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.t

Of_sexpable_with_uuid 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_with_uuid 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_sexpable_with_uuid (M : Conv_sexpable) : S with type t := M.t
module Of_stringable_with_uuid (M : Conv_stringable) : S with type t := M.t
module Of_sexpable_without_uuid (M : Sexpable.S) : S with type t := M.t
module Of_stringable_without_uuid (M : sig ... end) : 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:Base.Bool.t -> 'a m -> 'a -> bigstring

The following functors preserve stability: if applied to stable types with stable (de)serializations, they will produce stable types with stable (de)serializations.

Note: In all cases, stability of the input (and therefore the output) depends on the semantics of all conversion functions (e.g. to_string, to_sexpable) not changing in the future.

module Stable : sig ... end
val of_string : 'a m -> Base.String.t -> 'a
val to_string : 'a m -> 'a -> Base.String.t
module Of_binable = Of_binable_without_uuid
module Of_binable1 = Of_binable1_without_uuid
module Of_binable2 = Of_binable2_without_uuid
module Of_binable3 = Of_binable3_without_uuid
module Of_sexpable = Of_sexpable_without_uuid
module Of_stringable = Of_stringable_without_uuid
OCaml

Innovation. Community. Security.