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
open Base
module Message = Message
module Internal = struct
module Parser = Parser
module Serializer = Serializer
end
module Custom = struct
type t = Message.custom =
{ type_id : int
; data : Bytes.t
}
[@@deriving sexp, equal]
end
type t = Message.t =
| Nil
| Integer of int
| Int64 of Int64.t
| UInt64 of Int64.t
| Boolean of bool
| Floating of float
| Array of t list
| Map of (t * t) list
| String of string
| Binary of Bytes.t
| Extension of Custom.t
[@@deriving sexp, equal]
let t_of_string = Parser.parse
let t_of_string_exn s = Or_error.ok_exn (Parser.parse s)
let string_of_t_exn = Serializer.message_to_string_exn