package ppx_protocol_conv

  1. Overview
  2. Docs

Parameters

module D : Driver
module P : Parameters

Signature

type t = D.t

Serialized type. This type should not be opaque, so it is recommended that drivers implement the signature as Runtime.Driver with type t = ...

type error

Opaque error type

exception Protocol_error of error

Exception for protocol errors. The driver should make sure that this is the only exception raised when deserializing

val make_error : ?value:t -> Base.string -> error

Construct an error to be raised from a custom parser.

val error_to_string_hum : error -> Base.string

Convert an error type to a human readable string

val to_string_hum : t -> Base.string

Convert t to a string

val try_with : (t -> 'v) -> t -> ('v, error) Protocol_conv.Runtime.result

Wrap deserialization function to convert exceptions into an result type

val to_variant : (t, 'a) Protocol_conv.Runtime.Variant_in.t Base.list -> t -> 'a
val of_variant : Base.string -> (t, 'a, t) Protocol_conv.Runtime.Tuple_out.t -> 'a
val to_record : (t, 'constr, 'b) Protocol_conv.Runtime.Record_in.t -> 'constr -> t -> 'b
val of_record : (t, 'a, t) Protocol_conv.Runtime.Record_out.t -> 'a
val to_tuple : (t, 'constr, 'b) Protocol_conv.Runtime.Tuple_in.t -> 'constr -> t -> 'b
val of_tuple : (t, 'a, t) Protocol_conv.Runtime.Tuple_out.t -> 'a
val to_option : (t -> 'a) -> t -> 'a Base.option
val of_option : ('a -> t) -> 'a Base.option -> t
val to_ref : (t -> 'a) -> t -> 'a Base.ref
val of_ref : ('a -> t) -> 'a Base.ref -> t
val to_list : (t -> 'a) -> t -> 'a Base.list
val of_list : ('a -> t) -> 'a Base.list -> t
val to_array : (t -> 'a) -> t -> 'a Base.array
val of_array : ('a -> t) -> 'a Base.array -> t
val to_lazy_t : (t -> 'a) -> t -> 'a lazy_t
val of_lazy_t : ('a -> t) -> 'a lazy_t -> t
val to_int : t -> Base.int
val of_int : Base.int -> t
val to_int32 : t -> Base.int32
val of_int32 : Base.int32 -> t
val to_int64 : t -> Base.int64
val of_int64 : Base.int64 -> t
val to_nativeint : t -> Base.nativeint
val of_nativeint : Base.nativeint -> t
val to_char : t -> Base.char
val of_char : Base.char -> t
val to_string : t -> Base.string
val of_string : Base.string -> t
val to_float : t -> Base.float
val of_float : Base.float -> t
val to_bool : t -> Base.bool
val of_bool : Base.bool -> t
val to_unit : t -> Base.unit
val of_unit : Base.unit -> t
OCaml

Innovation. Community. Security.