package core_extended

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a t

A container for storing an 'a as a bin-io buffer. The advantages of storing a value as an 'a t rather than an 'a are:

  • it will take up less space
  • serializing 'a t is faster (it's just a blit) and it has the same bin-io representation as 'a.

However, every time you need to access 'a itself you need to call value, which requires deserializing.

'a t is safe in the sense that you cannot construct an 'a t that doesn't store a valid 'a. When deserializing an 'a, this requires actually constructing 'a. If you'd like access to the 'a that's constructed during deserialization, see the bin_reader_t_with_value below.

val create : 'a Core.Bin_prot.Type_class.writer -> 'a -> 'a t
val value : 'a t -> 'a Core.Bin_prot.Type_class.reader -> 'a
val bin_reader_t_with_value : 'a Core.Bin_prot.Type_class.reader -> ('a t * 'a) Core.Bin_prot.Type_class.reader

Deserializing requires actually constructing an 'a, so this reader gives you access to that 'a, rather than just throwing it away. This is useful because you often might want to do something like indexing 'a t by inspecting 'a at the time that you read it.

val bin_t_with_value : 'a Core.Bin_prot.Type_class.t -> ('a t * 'a) Core.Bin_prot.Type_class.t
module Make (B : Core.Binable) : sig ... end
OCaml

Innovation. Community. Security.