Page
Library
Module
Module type
Parameter
Class
Class type
Source
Bitpack_serializer.Lens
SourceLenses are useful tools defining data-types encodings. Lenses provides in a single OCaml value equivalent serializes and deserializers.
The type of lenses. An 'a lens
will provide symetical functions to read and write values of type 'a
.
Writes in a buffer.
Reads from a buffer.
Basic lenses
Given two lenses for two types, creates a lens for a pair of these types.
For creating a lens for disjunctions, we define the 'a case
type for the Lens.disj
function to build new lenses.
Builds a case for disjunctive lenses.
Creates a lens from an array of cases. Raises Failure
when reading or writing if no case matches the encoding.