package ppx_protocol_conv_json

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include Protocol_conv.Runtime.Driver with type t = Yojson.Safe.json
type t = Yojson.Safe.json

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 -> string -> error

Construct an error to be raised from a custom parser.

val error_to_string_hum : error -> string

Convert an error type to a human readable string

val to_string_hum : t -> 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 list -> t -> 'a
val of_variant : 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 option
val of_option : ('a -> t) -> 'a option -> t
val to_ref : (t -> 'a) -> t -> 'a Stdlib.ref
val of_ref : ('a -> t) -> 'a Stdlib.ref -> t
val to_list : (t -> 'a) -> t -> 'a list
val of_list : ('a -> t) -> 'a list -> t
val to_array : (t -> 'a) -> t -> 'a array
val of_array : ('a -> t) -> 'a array -> t
val to_lazy_t : (t -> 'a) -> t -> 'a lazy_t
val of_lazy_t : ('a -> t) -> 'a lazy_t -> t
val to_result : (t -> 'a) -> (t -> 'b) -> t -> ('a, 'b) Protocol_conv.Runtime.result
val of_result : ('a -> t) -> ('b -> t) -> ('a, 'b) Protocol_conv.Runtime.result -> t
val to_int : t -> int
val of_int : int -> t
val to_int32 : t -> int32
val of_int32 : int32 -> t
val to_int64 : t -> int64
val of_int64 : int64 -> t
val to_nativeint : t -> nativeint
val of_nativeint : nativeint -> t
val to_char : t -> char
val of_char : char -> t
val to_string : t -> string
val of_string : string -> t
val to_float : t -> float
val of_float : float -> t
val to_bool : t -> bool
val of_bool : bool -> t
val to_bytes : t -> bytes
val of_bytes : bytes -> t
val to_unit : t -> unit
val of_unit : unit -> t
val of_yojson_exn : t -> t
val of_yojson : t -> (t, error) Protocol_conv.Runtime.result
val to_yojson : t -> t
OCaml

Innovation. Community. Security.