package repr

  1. Overview
  2. Docs

Unboxed operations assumes that value being serialized is fully filling the underlying buffer. When that's the case, it is not necessary to prefix the value's binary representation by its size, as it is exactly the buffer's size.

Unboxed operations only apply to top-level string-like values. These are defined as follows:

  • they are not not embedded in a larger structured values;
  • they are either of type string or bytes;
  • or they are built by combining like and map operators to top-level string-like values.

When unboxed operations are applied to values not supporting that operation, they automatically fall-back to their boxed counter-part.

val encode_bin : 'a Repr__.Type.t -> ('a -> (string -> unit) -> unit) Repr__.Type.staged

Same as encode_bin for unboxed values.

val decode_bin : 'a Repr__.Type.t -> (string -> int -> int * 'a) Repr__.Type.staged

Same as decode_bin for unboxed values.

val size_of : 'a Repr__.Type.t -> ('a -> int option) Repr__.Type.staged

Same as size_of for unboxed values.