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 t -> 'a encode_bin staged

Same as encode_bin for unboxed values.

val decode_bin : 'a t -> 'a decode_bin staged

Same as decode_bin for unboxed values.

val size_of : 'a t -> 'a size_of

Same as size_of for unboxed values.