package ocaml-protoc-plugin

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file type.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
(********************************************************)
(*           AUTOGENERATED FILE - DO NOT EDIT!          *)
(********************************************************)
(* Generated by: ocaml-protoc-plugin                    *)
(* https://github.com/andersfugmann/ocaml-protoc-plugin *)
(********************************************************)
(*
  Source: google/protobuf/type.proto
  Syntax: proto3
  Parameters:
    debug=false
    annot=''
    opens=[]
    int64_as_int=true
    int32_as_int=true
    fixed_as_int=false
    singleton_record=false
*)

open Ocaml_protoc_plugin.Runtime [@@warning "-33"]
(**/**)
module Imported'modules = struct
  module Any = Any
  module Source_context = Source_context
end
(**/**)
module rec Google : sig
  module rec Protobuf : sig
    module rec Syntax : sig
      type t = SYNTAX_PROTO2 | SYNTAX_PROTO3
      val to_int: t -> int
      val from_int: int -> t Runtime'.Result.t
      val from_int_exn: int -> t
    end
    and Type : sig
      val name': unit -> string
      type t = { name: string; fields: Field.t list; oneofs: string list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?fields:Field.t list -> ?oneofs:string list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Field : sig
      module rec Kind : sig
        type t = TYPE_UNKNOWN | TYPE_DOUBLE | TYPE_FLOAT | TYPE_INT64 | TYPE_UINT64 | TYPE_INT32 | TYPE_FIXED64 | TYPE_FIXED32 | TYPE_BOOL | TYPE_STRING | TYPE_GROUP | TYPE_MESSAGE | TYPE_BYTES | TYPE_UINT32 | TYPE_ENUM | TYPE_SFIXED32 | TYPE_SFIXED64 | TYPE_SINT32 | TYPE_SINT64
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      and Cardinality : sig
        type t = CARDINALITY_UNKNOWN | CARDINALITY_OPTIONAL | CARDINALITY_REQUIRED | CARDINALITY_REPEATED
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      val name': unit -> string
      type t = { kind: Kind.t; cardinality: Cardinality.t; number: int; name: string; type_url: string; oneof_index: int; packed: bool; options: Option.t list; json_name: string; default_value: string }
      val make: ?kind:Kind.t -> ?cardinality:Cardinality.t -> ?number:int -> ?name:string -> ?type_url:string -> ?oneof_index:int -> ?packed:bool -> ?options:Option.t list -> ?json_name:string -> ?default_value:string -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Enum : sig
      val name': unit -> string
      type t = { name: string; enumvalue: EnumValue.t list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?enumvalue:EnumValue.t list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and EnumValue : sig
      val name': unit -> string
      type t = { name: string; number: int; options: Option.t list }
      val make: ?name:string -> ?number:int -> ?options:Option.t list -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Option : sig
      val name': unit -> string
      type t = { name: string; value: Imported'modules.Any.Google.Protobuf.Any.t option }
      val make: ?name:string -> ?value:Imported'modules.Any.Google.Protobuf.Any.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
  end
end = struct
  module rec Protobuf : sig
    module rec Syntax : sig
      type t = SYNTAX_PROTO2 | SYNTAX_PROTO3
      val to_int: t -> int
      val from_int: int -> t Runtime'.Result.t
      val from_int_exn: int -> t
    end
    and Type : sig
      val name': unit -> string
      type t = { name: string; fields: Field.t list; oneofs: string list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?fields:Field.t list -> ?oneofs:string list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Field : sig
      module rec Kind : sig
        type t = TYPE_UNKNOWN | TYPE_DOUBLE | TYPE_FLOAT | TYPE_INT64 | TYPE_UINT64 | TYPE_INT32 | TYPE_FIXED64 | TYPE_FIXED32 | TYPE_BOOL | TYPE_STRING | TYPE_GROUP | TYPE_MESSAGE | TYPE_BYTES | TYPE_UINT32 | TYPE_ENUM | TYPE_SFIXED32 | TYPE_SFIXED64 | TYPE_SINT32 | TYPE_SINT64
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      and Cardinality : sig
        type t = CARDINALITY_UNKNOWN | CARDINALITY_OPTIONAL | CARDINALITY_REQUIRED | CARDINALITY_REPEATED
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      val name': unit -> string
      type t = { kind: Kind.t; cardinality: Cardinality.t; number: int; name: string; type_url: string; oneof_index: int; packed: bool; options: Option.t list; json_name: string; default_value: string }
      val make: ?kind:Kind.t -> ?cardinality:Cardinality.t -> ?number:int -> ?name:string -> ?type_url:string -> ?oneof_index:int -> ?packed:bool -> ?options:Option.t list -> ?json_name:string -> ?default_value:string -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Enum : sig
      val name': unit -> string
      type t = { name: string; enumvalue: EnumValue.t list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?enumvalue:EnumValue.t list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and EnumValue : sig
      val name': unit -> string
      type t = { name: string; number: int; options: Option.t list }
      val make: ?name:string -> ?number:int -> ?options:Option.t list -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
    and Option : sig
      val name': unit -> string
      type t = { name: string; value: Imported'modules.Any.Google.Protobuf.Any.t option }
      val make: ?name:string -> ?value:Imported'modules.Any.Google.Protobuf.Any.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end
  end = struct
    module rec Syntax : sig
      type t = SYNTAX_PROTO2 | SYNTAX_PROTO3
      val to_int: t -> int
      val from_int: int -> t Runtime'.Result.t
      val from_int_exn: int -> t
    end = struct
      type t = SYNTAX_PROTO2 | SYNTAX_PROTO3
      let to_int = function
        | SYNTAX_PROTO2 -> 0
        | SYNTAX_PROTO3 -> 1

      let from_int_exn = function
        | 0 -> SYNTAX_PROTO2
        | 1 -> SYNTAX_PROTO3
        | n -> Runtime'.Result.raise (`Unknown_enum_value n)

      let from_int e = Runtime'.Result.catch (fun () -> from_int_exn e)
    end
    and Type : sig
      val name': unit -> string
      type t = { name: string; fields: Field.t list; oneofs: string list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?fields:Field.t list -> ?oneofs:string list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end = struct
      let name' () = "type.google.protobuf.Type"
      type t = { name: string; fields: Field.t list; oneofs: string list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      let make ?(name = {||}) ?(fields = []) ?(oneofs = []) ?(options = []) ?source_context ?(syntax = Syntax.SYNTAX_PROTO2) () = { name; fields; oneofs; options; source_context; syntax }
      let merge = (fun t1 t2 -> {
        name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
        fields = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (2, (message ((fun writer -> Field.from_proto_exn writer), Field.merge)), not_packed) ) t1.fields t2.fields);
        oneofs = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (3, string, not_packed) ) t1.oneofs t2.oneofs);
        options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (4, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ) t1.options t2.options);
        source_context = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic_opt (5, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ) t1.source_context t2.source_context);
        syntax = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (6, (enum Syntax.from_int_exn), (Syntax.SYNTAX_PROTO2)) ) t1.syntax t2.syntax);
         })
      let to_proto' =
        let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message Field.to_proto'), not_packed) ^:: repeated (3, string, not_packed) ^:: repeated (4, (message Option.to_proto'), not_packed) ^:: basic_opt (5, (message Imported'modules.Source_context.Google.Protobuf.SourceContext.to_proto')) ^:: basic (6, (enum Syntax.to_int), (Syntax.SYNTAX_PROTO2)) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize spec in
        fun writer { name; fields; oneofs; options; source_context; syntax } -> serialize writer name fields oneofs options source_context syntax

      let to_proto t = to_proto' (Runtime'.Writer.init ()) t
      let from_proto_exn =
        let constructor = fun name fields oneofs options source_context syntax -> { name; fields; oneofs; options; source_context; syntax } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message ((fun writer -> Field.from_proto_exn writer), Field.merge)), not_packed) ^:: repeated (3, string, not_packed) ^:: repeated (4, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ^:: basic_opt (5, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ^:: basic (6, (enum Syntax.from_int_exn), (Syntax.SYNTAX_PROTO2)) ^:: nil ) in
        Runtime'.Deserialize.deserialize spec constructor
      let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
    end
    and Field : sig
      module rec Kind : sig
        type t = TYPE_UNKNOWN | TYPE_DOUBLE | TYPE_FLOAT | TYPE_INT64 | TYPE_UINT64 | TYPE_INT32 | TYPE_FIXED64 | TYPE_FIXED32 | TYPE_BOOL | TYPE_STRING | TYPE_GROUP | TYPE_MESSAGE | TYPE_BYTES | TYPE_UINT32 | TYPE_ENUM | TYPE_SFIXED32 | TYPE_SFIXED64 | TYPE_SINT32 | TYPE_SINT64
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      and Cardinality : sig
        type t = CARDINALITY_UNKNOWN | CARDINALITY_OPTIONAL | CARDINALITY_REQUIRED | CARDINALITY_REPEATED
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end
      val name': unit -> string
      type t = { kind: Kind.t; cardinality: Cardinality.t; number: int; name: string; type_url: string; oneof_index: int; packed: bool; options: Option.t list; json_name: string; default_value: string }
      val make: ?kind:Kind.t -> ?cardinality:Cardinality.t -> ?number:int -> ?name:string -> ?type_url:string -> ?oneof_index:int -> ?packed:bool -> ?options:Option.t list -> ?json_name:string -> ?default_value:string -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end = struct
      module rec Kind : sig
        type t = TYPE_UNKNOWN | TYPE_DOUBLE | TYPE_FLOAT | TYPE_INT64 | TYPE_UINT64 | TYPE_INT32 | TYPE_FIXED64 | TYPE_FIXED32 | TYPE_BOOL | TYPE_STRING | TYPE_GROUP | TYPE_MESSAGE | TYPE_BYTES | TYPE_UINT32 | TYPE_ENUM | TYPE_SFIXED32 | TYPE_SFIXED64 | TYPE_SINT32 | TYPE_SINT64
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end = struct
        type t = TYPE_UNKNOWN | TYPE_DOUBLE | TYPE_FLOAT | TYPE_INT64 | TYPE_UINT64 | TYPE_INT32 | TYPE_FIXED64 | TYPE_FIXED32 | TYPE_BOOL | TYPE_STRING | TYPE_GROUP | TYPE_MESSAGE | TYPE_BYTES | TYPE_UINT32 | TYPE_ENUM | TYPE_SFIXED32 | TYPE_SFIXED64 | TYPE_SINT32 | TYPE_SINT64
        let to_int = function
          | TYPE_UNKNOWN -> 0
          | TYPE_DOUBLE -> 1
          | TYPE_FLOAT -> 2
          | TYPE_INT64 -> 3
          | TYPE_UINT64 -> 4
          | TYPE_INT32 -> 5
          | TYPE_FIXED64 -> 6
          | TYPE_FIXED32 -> 7
          | TYPE_BOOL -> 8
          | TYPE_STRING -> 9
          | TYPE_GROUP -> 10
          | TYPE_MESSAGE -> 11
          | TYPE_BYTES -> 12
          | TYPE_UINT32 -> 13
          | TYPE_ENUM -> 14
          | TYPE_SFIXED32 -> 15
          | TYPE_SFIXED64 -> 16
          | TYPE_SINT32 -> 17
          | TYPE_SINT64 -> 18

        let from_int_exn = function
          | 0 -> TYPE_UNKNOWN
          | 1 -> TYPE_DOUBLE
          | 2 -> TYPE_FLOAT
          | 3 -> TYPE_INT64
          | 4 -> TYPE_UINT64
          | 5 -> TYPE_INT32
          | 6 -> TYPE_FIXED64
          | 7 -> TYPE_FIXED32
          | 8 -> TYPE_BOOL
          | 9 -> TYPE_STRING
          | 10 -> TYPE_GROUP
          | 11 -> TYPE_MESSAGE
          | 12 -> TYPE_BYTES
          | 13 -> TYPE_UINT32
          | 14 -> TYPE_ENUM
          | 15 -> TYPE_SFIXED32
          | 16 -> TYPE_SFIXED64
          | 17 -> TYPE_SINT32
          | 18 -> TYPE_SINT64
          | n -> Runtime'.Result.raise (`Unknown_enum_value n)

        let from_int e = Runtime'.Result.catch (fun () -> from_int_exn e)
      end
      and Cardinality : sig
        type t = CARDINALITY_UNKNOWN | CARDINALITY_OPTIONAL | CARDINALITY_REQUIRED | CARDINALITY_REPEATED
        val to_int: t -> int
        val from_int: int -> t Runtime'.Result.t
        val from_int_exn: int -> t
      end = struct
        type t = CARDINALITY_UNKNOWN | CARDINALITY_OPTIONAL | CARDINALITY_REQUIRED | CARDINALITY_REPEATED
        let to_int = function
          | CARDINALITY_UNKNOWN -> 0
          | CARDINALITY_OPTIONAL -> 1
          | CARDINALITY_REQUIRED -> 2
          | CARDINALITY_REPEATED -> 3

        let from_int_exn = function
          | 0 -> CARDINALITY_UNKNOWN
          | 1 -> CARDINALITY_OPTIONAL
          | 2 -> CARDINALITY_REQUIRED
          | 3 -> CARDINALITY_REPEATED
          | n -> Runtime'.Result.raise (`Unknown_enum_value n)

        let from_int e = Runtime'.Result.catch (fun () -> from_int_exn e)
      end
      let name' () = "type.google.protobuf.Field"
      type t = { kind: Kind.t; cardinality: Cardinality.t; number: int; name: string; type_url: string; oneof_index: int; packed: bool; options: Option.t list; json_name: string; default_value: string }
      let make ?(kind = Kind.TYPE_UNKNOWN) ?(cardinality = Cardinality.CARDINALITY_UNKNOWN) ?(number = 0) ?(name = {||}) ?(type_url = {||}) ?(oneof_index = 0) ?(packed = false) ?(options = []) ?(json_name = {||}) ?(default_value = {||}) () = { kind; cardinality; number; name; type_url; oneof_index; packed; options; json_name; default_value }
      let merge = (fun t1 t2 -> {
        kind = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, (enum Kind.from_int_exn), (Kind.TYPE_UNKNOWN)) ) t1.kind t2.kind);
        cardinality = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (2, (enum Cardinality.from_int_exn), (Cardinality.CARDINALITY_UNKNOWN)) ) t1.cardinality t2.cardinality);
        number = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (3, int32_int, (0)) ) t1.number t2.number);
        name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (4, string, ({||})) ) t1.name t2.name);
        type_url = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (6, string, ({||})) ) t1.type_url t2.type_url);
        oneof_index = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (7, int32_int, (0)) ) t1.oneof_index t2.oneof_index);
        packed = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (8, bool, (false)) ) t1.packed t2.packed);
        options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (9, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ) t1.options t2.options);
        json_name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (10, string, ({||})) ) t1.json_name t2.json_name);
        default_value = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (11, string, ({||})) ) t1.default_value t2.default_value);
         })
      let to_proto' =
        let spec = Runtime'.Serialize.C.( basic (1, (enum Kind.to_int), (Kind.TYPE_UNKNOWN)) ^:: basic (2, (enum Cardinality.to_int), (Cardinality.CARDINALITY_UNKNOWN)) ^:: basic (3, int32_int, (0)) ^:: basic (4, string, ({||})) ^:: basic (6, string, ({||})) ^:: basic (7, int32_int, (0)) ^:: basic (8, bool, (false)) ^:: repeated (9, (message Option.to_proto'), not_packed) ^:: basic (10, string, ({||})) ^:: basic (11, string, ({||})) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize spec in
        fun writer { kind; cardinality; number; name; type_url; oneof_index; packed; options; json_name; default_value } -> serialize writer kind cardinality number name type_url oneof_index packed options json_name default_value

      let to_proto t = to_proto' (Runtime'.Writer.init ()) t
      let from_proto_exn =
        let constructor = fun kind cardinality number name type_url oneof_index packed options json_name default_value -> { kind; cardinality; number; name; type_url; oneof_index; packed; options; json_name; default_value } in
        let spec = Runtime'.Deserialize.C.( basic (1, (enum Kind.from_int_exn), (Kind.TYPE_UNKNOWN)) ^:: basic (2, (enum Cardinality.from_int_exn), (Cardinality.CARDINALITY_UNKNOWN)) ^:: basic (3, int32_int, (0)) ^:: basic (4, string, ({||})) ^:: basic (6, string, ({||})) ^:: basic (7, int32_int, (0)) ^:: basic (8, bool, (false)) ^:: repeated (9, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ^:: basic (10, string, ({||})) ^:: basic (11, string, ({||})) ^:: nil ) in
        Runtime'.Deserialize.deserialize spec constructor
      let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
    end
    and Enum : sig
      val name': unit -> string
      type t = { name: string; enumvalue: EnumValue.t list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      val make: ?name:string -> ?enumvalue:EnumValue.t list -> ?options:Option.t list -> ?source_context:Imported'modules.Source_context.Google.Protobuf.SourceContext.t -> ?syntax:Syntax.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end = struct
      let name' () = "type.google.protobuf.Enum"
      type t = { name: string; enumvalue: EnumValue.t list; options: Option.t list; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; syntax: Syntax.t }
      let make ?(name = {||}) ?(enumvalue = []) ?(options = []) ?source_context ?(syntax = Syntax.SYNTAX_PROTO2) () = { name; enumvalue; options; source_context; syntax }
      let merge = (fun t1 t2 -> {
        name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
        enumvalue = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (2, (message ((fun writer -> EnumValue.from_proto_exn writer), EnumValue.merge)), not_packed) ) t1.enumvalue t2.enumvalue);
        options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (3, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ) t1.options t2.options);
        source_context = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic_opt (4, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ) t1.source_context t2.source_context);
        syntax = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (5, (enum Syntax.from_int_exn), (Syntax.SYNTAX_PROTO2)) ) t1.syntax t2.syntax);
         })
      let to_proto' =
        let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message EnumValue.to_proto'), not_packed) ^:: repeated (3, (message Option.to_proto'), not_packed) ^:: basic_opt (4, (message Imported'modules.Source_context.Google.Protobuf.SourceContext.to_proto')) ^:: basic (5, (enum Syntax.to_int), (Syntax.SYNTAX_PROTO2)) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize spec in
        fun writer { name; enumvalue; options; source_context; syntax } -> serialize writer name enumvalue options source_context syntax

      let to_proto t = to_proto' (Runtime'.Writer.init ()) t
      let from_proto_exn =
        let constructor = fun name enumvalue options source_context syntax -> { name; enumvalue; options; source_context; syntax } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: repeated (2, (message ((fun writer -> EnumValue.from_proto_exn writer), EnumValue.merge)), not_packed) ^:: repeated (3, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ^:: basic_opt (4, (message ((fun writer -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto_exn writer), Imported'modules.Source_context.Google.Protobuf.SourceContext.merge))) ^:: basic (5, (enum Syntax.from_int_exn), (Syntax.SYNTAX_PROTO2)) ^:: nil ) in
        Runtime'.Deserialize.deserialize spec constructor
      let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
    end
    and EnumValue : sig
      val name': unit -> string
      type t = { name: string; number: int; options: Option.t list }
      val make: ?name:string -> ?number:int -> ?options:Option.t list -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end = struct
      let name' () = "type.google.protobuf.EnumValue"
      type t = { name: string; number: int; options: Option.t list }
      let make ?(name = {||}) ?(number = 0) ?(options = []) () = { name; number; options }
      let merge = (fun t1 t2 -> {
        name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
        number = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (2, int32_int, (0)) ) t1.number t2.number);
        options = (Runtime'.Merge.merge Runtime'.Deserialize.C.( repeated (3, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ) t1.options t2.options);
         })
      let to_proto' =
        let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: basic (2, int32_int, (0)) ^:: repeated (3, (message Option.to_proto'), not_packed) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize spec in
        fun writer { name; number; options } -> serialize writer name number options

      let to_proto t = to_proto' (Runtime'.Writer.init ()) t
      let from_proto_exn =
        let constructor = fun name number options -> { name; number; options } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: basic (2, int32_int, (0)) ^:: repeated (3, (message ((fun writer -> Option.from_proto_exn writer), Option.merge)), not_packed) ^:: nil ) in
        Runtime'.Deserialize.deserialize spec constructor
      let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
    end
    and Option : sig
      val name': unit -> string
      type t = { name: string; value: Imported'modules.Any.Google.Protobuf.Any.t option }
      val make: ?name:string -> ?value:Imported'modules.Any.Google.Protobuf.Any.t -> unit -> t
      val merge: t -> t -> t
      val to_proto': Runtime'.Writer.t -> t -> Runtime'.Writer.t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
      val from_proto_exn: Runtime'.Reader.t -> t
    end = struct
      let name' () = "type.google.protobuf.Option"
      type t = { name: string; value: Imported'modules.Any.Google.Protobuf.Any.t option }
      let make ?(name = {||}) ?value () = { name; value }
      let merge = (fun t1 t2 -> {
        name = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic (1, string, ({||})) ) t1.name t2.name);
        value = (Runtime'.Merge.merge Runtime'.Deserialize.C.( basic_opt (2, (message ((fun writer -> Imported'modules.Any.Google.Protobuf.Any.from_proto_exn writer), Imported'modules.Any.Google.Protobuf.Any.merge))) ) t1.value t2.value);
         })
      let to_proto' =
        let spec = Runtime'.Serialize.C.( basic (1, string, ({||})) ^:: basic_opt (2, (message Imported'modules.Any.Google.Protobuf.Any.to_proto')) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize spec in
        fun writer { name; value } -> serialize writer name value

      let to_proto t = to_proto' (Runtime'.Writer.init ()) t
      let from_proto_exn =
        let constructor = fun name value -> { name; value } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, ({||})) ^:: basic_opt (2, (message ((fun writer -> Imported'modules.Any.Google.Protobuf.Any.from_proto_exn writer), Imported'modules.Any.Google.Protobuf.Any.merge))) ^:: nil ) in
        Runtime'.Deserialize.deserialize spec constructor
      let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer)
    end
  end
end
OCaml

Innovation. Community. Security.