Std.Data
Data types support module.
Data is a collection of bits, that can be stored and loaded on some media. This module provides functions for doing this in a generic way.
To be on a safe side, we insist on explicit versioning of each data representation. Otherwise, any OCaml value is suitable for this module.
The module defines interfaces Data.S
that describes the expected set of functions for data. It also defines a Cache
.S interface, that is useful for caching data that is hard to obtain.
copy buf obj pos
is a method to copy object obj
into a buffer buf
, starting from a position pos
and will return the number of bytes written. XXX: we need the amount of bytes beforehand.
dump out obj
a type of functions that outputs a value obj
into output out
val all_readers : unit -> (string * info list) list
val all_writers : unit -> (string * info list) list
val set_module_name : 'a cls -> string -> unit
module Versioned : sig ... end
Versioned interfaces
val marshal_reader : (module Core_kernel.T with type t = 'a) -> 'a reader
marshal_reader (module T)
returns a reader in OCaml Marshal
format.
val marshal_writer : (module Core_kernel.T with type t = 'a) -> 'a writer
marshal_writer (module T)
returns a writer in OCaml Marshal
format.
val sexp_reader : (module Core_kernel.Sexpable with type t = 'a) -> 'a reader
sexp_reader (module T)
returns a reader in sexp format.
sexp_writer (module T)
returns a writer in sexp format.
val sexp_writer : (module Core_kernel.Sexpable with type t = 'a) -> 'a writer
sexp_writer (module T)
returns a writer in sexp format.
val bin_reader : (module Core_kernel.Binable with type t = 'a) -> 'a reader
bin_reader (module T)
returns a reader in binprot format.
val bin_writer : (module Core_kernel.Binable with type t = 'a) -> 'a writer
bin_writer (module T)
returns a writer in binprot format.
val pretty_writer :
(module Core_kernel.Pretty_printer.S with type t = 'a) ->
'a writer
pretty_printer (module T
creates a writer that uses T.pp
function for outputting.
module type S = sig ... end
Data type interface.
module type With_instance = sig ... end
module Make (T : Versioned.S) : With_instance with type t := T.t
Implements Data.S
interface from the provided minimal implementation.
module Read : sig ... end
Read
typeclass.
module Write : sig ... end
Write typeclass.
module Cache : sig ... end
Generic caching.