package ppx_protocol_conv
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b13fbc761c2aa3729b23a1362f140a18
sha512=95d8dabb38d7fe3f7a0ff2b4c17547ec5d2e30c4b83d1f166444ad8fa91ef02ee86ee855ef40bedc86a42ab35b2665a5001af9e2521dc7a648aa8b38c4143765
doc/ppx_protocol_conv.runtime/Protocol_conv/Runtime/Helper/index.html
Module Runtime.Helper
Module contains helper function for serializing and deserializing tuples, records and variants. Deserialization functions may raise Helper.Protocol exception. It is recommended that the calling functions convert this exception into a Driver.Protocol_exception
Tail recursive version of map
val map_record_in :
't 'a 'b. (string -> string) ->
('t, 'a, 'b) Record_in.t ->
('t, 'a, 'b) Record_in.tMap fields names of a Record_in structure
val to_record :
't 'constr 'b. ?strict:bool ->
('t, 'constr, 'b) Record_in.t ->
'constr ->
(string * 't) list ->
'bto_recordspecconstructorts returns the constructed value. ts is a associative array (string * t) list, mapping fields to the deserialized value t if strict is true, an error will be raised if input contains an unknown field. If dublicate fields are found in the input, an error is raised
val map_record_out :
't 'a. (string -> string) ->
('t, 'a, 't) Record_out.t ->
('t, 'a, 't) Record_out.tMap fields names of a Record_out structure
val of_record :
't 'a. omit_default:bool ->
't serialize_record ->
('t, 'a, 't) Record_out.t ->
'aof_recordmap_fspec produces a valid deserialisation function for a record type The map_f function is called to produce the serialized result from a field_name, t association list. If omit_default is true, then default values are omitted from the output
val to_tuple : 't 'a 'b. ('t, 'a, 'b) Tuple_in.t -> 'a -> 't list -> 'bto_tuplespectlist produces a tuple from the serialized values in tlist
val of_tuple : 't 'a. 't serialize_tuple -> ('t, 'a, 't) Tuple_out.t -> 'aval of_variant :
't. 't serialize_variant ->
string ->
('t, 'a, 't) Tuple_out.t ->
'aof_variantspecv serializes v and returns the serialized values as a list or map
val map_constructor_names :
(string -> string) ->
('t, 'a) Variant_in.t list ->
('t, 'a) Variant_in.t listMap field names in all inline records of the spec
val to_variant : ('t, 'a) Variant_in.t list -> string -> 't list -> 'a