package repr

  1. Overview
  2. Docs

Module Repr.SizeSource

Sourcetype 'a t = private 'a Size.t =
  1. | Static of int
  2. | Dynamic of 'a
  3. | Unknown

A value representing information known about the length in bytes of encodings produced by a particular binary codec:

  • Static n: all encodings produced by this codec have length n;
  • Dynamic f: the length of binary encodings is dependent on the specific value, but may be efficiently computed at run-time via the function f.
  • Unknown: this codec may produce encodings that cannot be efficiently pre-computed.
Sourceval of_value : 'a Repr__.Type.t -> ('a -> int) t
Sourceval of_encoding : 'a Repr__.Type.t -> (string -> int -> int) t

Constructors for custom value sizers, for use with binary codecs that are not structurally-defined.

Sourcetype -'a sizer
Sourceval t : 'a Repr__.Type.t -> 'a sizer
Sourceval using : ('b -> 'a) -> 'a sizer -> 'b sizer
Sourceval custom_static : int -> _ sizer
Sourceval custom_dynamic : ?of_value:('a -> int) -> ?of_encoding:(string -> int -> int) -> unit -> 'a sizer