Source file google_protobuf_empty_pc.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[@@@ocaml.warning "-39"]
let (>>=) = Runtime.Result.(>>=)
let (>>|) = Runtime.Result.(>>|)
module Field' = Runtime.Field_value
module Bin' = Runtime.Binary_format
module Text' = Runtime.Text_format
module rec Empty : sig
type t = unit
[@@deriving eq, show]
val to_binary : t -> (string, [> Bin'.serialization_error]) result
val of_binary : string -> (t, [> Bin'.deserialization_error]) result
val to_text : t -> (string, [> Text'.serialization_error]) result
val of_text : string -> (t, [> Text'.deserialization_error]) result
end = struct
type t = unit
[@@deriving eq, show]
let rec to_binary =
fun () ->
let _o = Runtime.Byte_output.create () in
Ok (Runtime.Byte_output.contents _o)
let rec of_binary =
fun input' ->
Ok (Runtime.Byte_input.create input') >>=
Bin'.deserialize_message >>= fun _m ->
Ok ()
let rec to_text =
fun () ->
let _o = Runtime.Byte_output.create () in
Ok (Runtime.Byte_output.contents _o)
let rec of_text =
fun input' ->
Ok (Runtime.Byte_input.create input') >>=
Text'.deserialize_message >>= fun _m ->
Ok ()
end