Source file descriptor.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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
open Ocaml_protoc_plugin.Runtime [@@warning "-33"]
module Google = struct
module Protobuf = struct
module rec FileDescriptorSet : sig
val name': unit -> string
type t = FileDescriptorProto.t list
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.FileDescriptorSet"
type t = FileDescriptorProto.t list
let to_proto =
let apply = fun ~f a -> f [] a in
let spec = Runtime'.Serialize.C.( repeated (1, (message (fun t -> FileDescriptorProto.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions a -> a in
let spec = Runtime'.Deserialize.C.( repeated (1, (message (fun t -> FileDescriptorProto.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and FileDescriptorProto : sig
val name': unit -> string
type t = { name: string option; package: string option; dependency: string list; public_dependency: int list; weak_dependency: int list; message_type: DescriptorProto.t list; enum_type: EnumDescriptorProto.t list; service: ServiceDescriptorProto.t list; extension: FieldDescriptorProto.t list; options: FileOptions.t option; source_code_info: SourceCodeInfo.t option; syntax: string option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.FileDescriptorProto"
type t = { name: string option; package: string option; dependency: string list; public_dependency: int list; weak_dependency: int list; message_type: DescriptorProto.t list; enum_type: EnumDescriptorProto.t list; service: ServiceDescriptorProto.t list; extension: FieldDescriptorProto.t list; options: FileOptions.t option; source_code_info: SourceCodeInfo.t option; syntax: string option }
let to_proto =
let apply = fun ~f:f' { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax } -> f' [] name package dependency public_dependency weak_dependency message_type enum_type service extension options source_code_info syntax in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (2, string) ^:: repeated (3, string, not_packed) ^:: repeated (10, int32_int, not_packed) ^:: repeated (11, int32_int, not_packed) ^:: repeated (4, (message (fun t -> DescriptorProto.to_proto t)), not_packed) ^:: repeated (5, (message (fun t -> EnumDescriptorProto.to_proto t)), not_packed) ^:: repeated (6, (message (fun t -> ServiceDescriptorProto.to_proto t)), not_packed) ^:: repeated (7, (message (fun t -> FieldDescriptorProto.to_proto t)), not_packed) ^:: basic_opt (8, (message (fun t -> FileOptions.to_proto t))) ^:: basic_opt (9, (message (fun t -> SourceCodeInfo.to_proto t))) ^:: basic_opt (12, string) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name package dependency public_dependency weak_dependency message_type enum_type service extension options source_code_info syntax -> { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (2, string) ^:: repeated (3, string, not_packed) ^:: repeated (10, int32_int, not_packed) ^:: repeated (11, int32_int, not_packed) ^:: repeated (4, (message (fun t -> DescriptorProto.from_proto t)), not_packed) ^:: repeated (5, (message (fun t -> EnumDescriptorProto.from_proto t)), not_packed) ^:: repeated (6, (message (fun t -> ServiceDescriptorProto.from_proto t)), not_packed) ^:: repeated (7, (message (fun t -> FieldDescriptorProto.from_proto t)), not_packed) ^:: basic_opt (8, (message (fun t -> FileOptions.from_proto t))) ^:: basic_opt (9, (message (fun t -> SourceCodeInfo.from_proto t))) ^:: basic_opt (12, string) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and DescriptorProto : sig
module rec ExtensionRange : sig
val name': unit -> string
type t = { start: int option; end': int option; options: ExtensionRangeOptions.t option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
and ReservedRange : sig
val name': unit -> string
type t = { start: int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { name: string option; field: FieldDescriptorProto.t list; extension: FieldDescriptorProto.t list; nested_type: DescriptorProto.t list; enum_type: EnumDescriptorProto.t list; extension_range: DescriptorProto.ExtensionRange.t list; oneof_decl: OneofDescriptorProto.t list; options: MessageOptions.t option; reserved_range: DescriptorProto.ReservedRange.t list; reserved_name: string list }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec ExtensionRange : sig
val name': unit -> string
type t = { start: int option; end': int option; options: ExtensionRangeOptions.t option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.DescriptorProto.ExtensionRange"
type t = { start: int option; end': int option; options: ExtensionRangeOptions.t option }
let to_proto =
let apply = fun ~f:f' { start; end'; options } -> f' [] start end' options in
let spec = Runtime'.Serialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: basic_opt (3, (message (fun t -> ExtensionRangeOptions.to_proto t))) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions start end' options -> { start; end'; options } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: basic_opt (3, (message (fun t -> ExtensionRangeOptions.from_proto t))) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and ReservedRange : sig
val name': unit -> string
type t = { start: int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.DescriptorProto.ReservedRange"
type t = { start: int option; end': int option }
let to_proto =
let apply = fun ~f:f' { start; end' } -> f' [] start end' in
let spec = Runtime'.Serialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions start end' -> { start; end' } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
let name' () = "descriptor.google.protobuf.DescriptorProto"
type t = { name: string option; field: FieldDescriptorProto.t list; extension: FieldDescriptorProto.t list; nested_type: DescriptorProto.t list; enum_type: EnumDescriptorProto.t list; extension_range: DescriptorProto.ExtensionRange.t list; oneof_decl: OneofDescriptorProto.t list; options: MessageOptions.t option; reserved_range: DescriptorProto.ReservedRange.t list; reserved_name: string list }
let to_proto =
let apply = fun ~f:f' { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name } -> f' [] name field extension nested_type enum_type extension_range oneof_decl options reserved_range reserved_name in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> FieldDescriptorProto.to_proto t)), not_packed) ^:: repeated (6, (message (fun t -> FieldDescriptorProto.to_proto t)), not_packed) ^:: repeated (3, (message (fun t -> DescriptorProto.to_proto t)), not_packed) ^:: repeated (4, (message (fun t -> EnumDescriptorProto.to_proto t)), not_packed) ^:: repeated (5, (message (fun t -> DescriptorProto.ExtensionRange.to_proto t)), not_packed) ^:: repeated (8, (message (fun t -> OneofDescriptorProto.to_proto t)), not_packed) ^:: basic_opt (7, (message (fun t -> MessageOptions.to_proto t))) ^:: repeated (9, (message (fun t -> DescriptorProto.ReservedRange.to_proto t)), not_packed) ^:: repeated (10, string, not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name field extension nested_type enum_type extension_range oneof_decl options reserved_range reserved_name -> { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> FieldDescriptorProto.from_proto t)), not_packed) ^:: repeated (6, (message (fun t -> FieldDescriptorProto.from_proto t)), not_packed) ^:: repeated (3, (message (fun t -> DescriptorProto.from_proto t)), not_packed) ^:: repeated (4, (message (fun t -> EnumDescriptorProto.from_proto t)), not_packed) ^:: repeated (5, (message (fun t -> DescriptorProto.ExtensionRange.from_proto t)), not_packed) ^:: repeated (8, (message (fun t -> OneofDescriptorProto.from_proto t)), not_packed) ^:: basic_opt (7, (message (fun t -> MessageOptions.from_proto t))) ^:: repeated (9, (message (fun t -> DescriptorProto.ReservedRange.from_proto t)), not_packed) ^:: repeated (10, string, not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and ExtensionRangeOptions : sig
val name': unit -> string
type t = { uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.ExtensionRangeOptions"
type t = { uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { uninterpreted_option; extensions' } -> f' extensions' uninterpreted_option in
let spec = Runtime'.Serialize.C.( repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' uninterpreted_option -> { uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and FieldDescriptorProto : sig
module rec Type : sig
type t = 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.error]) result
end
and Label : sig
type t = LABEL_OPTIONAL | LABEL_REQUIRED | LABEL_REPEATED
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { name: string option; number: int option; label: FieldDescriptorProto.Label.t option; type': FieldDescriptorProto.Type.t option; type_name: string option; extendee: string option; default_value: string option; oneof_index: int option; json_name: string option; options: FieldOptions.t option; proto3_optional: bool option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec Type : sig
type t = 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.error]) result
end = struct
type t = 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_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 = function
| 1 -> Ok TYPE_DOUBLE
| 2 -> Ok TYPE_FLOAT
| 3 -> Ok TYPE_INT64
| 4 -> Ok TYPE_UINT64
| 5 -> Ok TYPE_INT32
| 6 -> Ok TYPE_FIXED64
| 7 -> Ok TYPE_FIXED32
| 8 -> Ok TYPE_BOOL
| 9 -> Ok TYPE_STRING
| 10 -> Ok TYPE_GROUP
| 11 -> Ok TYPE_MESSAGE
| 12 -> Ok TYPE_BYTES
| 13 -> Ok TYPE_UINT32
| 14 -> Ok TYPE_ENUM
| 15 -> Ok TYPE_SFIXED32
| 16 -> Ok TYPE_SFIXED64
| 17 -> Ok TYPE_SINT32
| 18 -> Ok TYPE_SINT64
| n -> Error (`Unknown_enum_value n)
end
and Label : sig
type t = LABEL_OPTIONAL | LABEL_REQUIRED | LABEL_REPEATED
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end = struct
type t = LABEL_OPTIONAL | LABEL_REQUIRED | LABEL_REPEATED
let to_int = function
| LABEL_OPTIONAL -> 1
| LABEL_REQUIRED -> 2
| LABEL_REPEATED -> 3
let from_int = function
| 1 -> Ok LABEL_OPTIONAL
| 2 -> Ok LABEL_REQUIRED
| 3 -> Ok LABEL_REPEATED
| n -> Error (`Unknown_enum_value n)
end
let name' () = "descriptor.google.protobuf.FieldDescriptorProto"
type t = { name: string option; number: int option; label: FieldDescriptorProto.Label.t option; type': FieldDescriptorProto.Type.t option; type_name: string option; extendee: string option; default_value: string option; oneof_index: int option; json_name: string option; options: FieldOptions.t option; proto3_optional: bool option }
let to_proto =
let apply = fun ~f:f' { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options; proto3_optional } -> f' [] name number label type' type_name extendee default_value oneof_index json_name options proto3_optional in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (3, int32_int) ^:: basic_opt (4, (enum FieldDescriptorProto.Label.to_int)) ^:: basic_opt (5, (enum FieldDescriptorProto.Type.to_int)) ^:: basic_opt (6, string) ^:: basic_opt (2, string) ^:: basic_opt (7, string) ^:: basic_opt (9, int32_int) ^:: basic_opt (10, string) ^:: basic_opt (8, (message (fun t -> FieldOptions.to_proto t))) ^:: basic_opt (17, bool) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name number label type' type_name extendee default_value oneof_index json_name options proto3_optional -> { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options; proto3_optional } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (3, int32_int) ^:: basic_opt (4, (enum FieldDescriptorProto.Label.from_int)) ^:: basic_opt (5, (enum FieldDescriptorProto.Type.from_int)) ^:: basic_opt (6, string) ^:: basic_opt (2, string) ^:: basic_opt (7, string) ^:: basic_opt (9, int32_int) ^:: basic_opt (10, string) ^:: basic_opt (8, (message (fun t -> FieldOptions.from_proto t))) ^:: basic_opt (17, bool) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and OneofDescriptorProto : sig
val name': unit -> string
type t = { name: string option; options: OneofOptions.t option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.OneofDescriptorProto"
type t = { name: string option; options: OneofOptions.t option }
let to_proto =
let apply = fun ~f:f' { name; options } -> f' [] name options in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (2, (message (fun t -> OneofOptions.to_proto t))) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name options -> { name; options } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (2, (message (fun t -> OneofOptions.from_proto t))) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and EnumDescriptorProto : sig
module rec EnumReservedRange : sig
val name': unit -> string
type t = { start: int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { name: string option; value: EnumValueDescriptorProto.t list; options: EnumOptions.t option; reserved_range: EnumDescriptorProto.EnumReservedRange.t list; reserved_name: string list }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec EnumReservedRange : sig
val name': unit -> string
type t = { start: int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.EnumDescriptorProto.EnumReservedRange"
type t = { start: int option; end': int option }
let to_proto =
let apply = fun ~f:f' { start; end' } -> f' [] start end' in
let spec = Runtime'.Serialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions start end' -> { start; end' } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, int32_int) ^:: basic_opt (2, int32_int) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
let name' () = "descriptor.google.protobuf.EnumDescriptorProto"
type t = { name: string option; value: EnumValueDescriptorProto.t list; options: EnumOptions.t option; reserved_range: EnumDescriptorProto.EnumReservedRange.t list; reserved_name: string list }
let to_proto =
let apply = fun ~f:f' { name; value; options; reserved_range; reserved_name } -> f' [] name value options reserved_range reserved_name in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> EnumValueDescriptorProto.to_proto t)), not_packed) ^:: basic_opt (3, (message (fun t -> EnumOptions.to_proto t))) ^:: repeated (4, (message (fun t -> EnumDescriptorProto.EnumReservedRange.to_proto t)), not_packed) ^:: repeated (5, string, not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name value options reserved_range reserved_name -> { name; value; options; reserved_range; reserved_name } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> EnumValueDescriptorProto.from_proto t)), not_packed) ^:: basic_opt (3, (message (fun t -> EnumOptions.from_proto t))) ^:: repeated (4, (message (fun t -> EnumDescriptorProto.EnumReservedRange.from_proto t)), not_packed) ^:: repeated (5, string, not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and EnumValueDescriptorProto : sig
val name': unit -> string
type t = { name: string option; number: int option; options: EnumValueOptions.t option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.EnumValueDescriptorProto"
type t = { name: string option; number: int option; options: EnumValueOptions.t option }
let to_proto =
let apply = fun ~f:f' { name; number; options } -> f' [] name number options in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (2, int32_int) ^:: basic_opt (3, (message (fun t -> EnumValueOptions.to_proto t))) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name number options -> { name; number; options } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (2, int32_int) ^:: basic_opt (3, (message (fun t -> EnumValueOptions.from_proto t))) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and ServiceDescriptorProto : sig
val name': unit -> string
type t = { name: string option; method': MethodDescriptorProto.t list; options: ServiceOptions.t option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.ServiceDescriptorProto"
type t = { name: string option; method': MethodDescriptorProto.t list; options: ServiceOptions.t option }
let to_proto =
let apply = fun ~f:f' { name; method'; options } -> f' [] name method' options in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> MethodDescriptorProto.to_proto t)), not_packed) ^:: basic_opt (3, (message (fun t -> ServiceOptions.to_proto t))) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name method' options -> { name; method'; options } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: repeated (2, (message (fun t -> MethodDescriptorProto.from_proto t)), not_packed) ^:: basic_opt (3, (message (fun t -> ServiceOptions.from_proto t))) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and MethodDescriptorProto : sig
val name': unit -> string
type t = { name: string option; input_type: string option; output_type: string option; options: MethodOptions.t option; client_streaming: bool; server_streaming: bool }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.MethodDescriptorProto"
type t = { name: string option; input_type: string option; output_type: string option; options: MethodOptions.t option; client_streaming: bool; server_streaming: bool }
let to_proto =
let apply = fun ~f:f' { name; input_type; output_type; options; client_streaming; server_streaming } -> f' [] name input_type output_type options client_streaming server_streaming in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (2, string) ^:: basic_opt (3, string) ^:: basic_opt (4, (message (fun t -> MethodOptions.to_proto t))) ^:: basic (5, bool, proto2 (false)) ^:: basic (6, bool, proto2 (false)) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name input_type output_type options client_streaming server_streaming -> { name; input_type; output_type; options; client_streaming; server_streaming } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (2, string) ^:: basic_opt (3, string) ^:: basic_opt (4, (message (fun t -> MethodOptions.from_proto t))) ^:: basic (5, bool, proto2 (false)) ^:: basic (6, bool, proto2 (false)) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and FileOptions : sig
module rec OptimizeMode : sig
type t = SPEED | CODE_SIZE | LITE_RUNTIME
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { java_package: string option; java_outer_classname: string option; java_multiple_files: bool; java_generate_equals_and_hash: bool option; java_string_check_utf8: bool; optimize_for: FileOptions.OptimizeMode.t; go_package: string option; cc_generic_services: bool; java_generic_services: bool; py_generic_services: bool; php_generic_services: bool; deprecated: bool; cc_enable_arenas: bool; objc_class_prefix: string option; csharp_namespace: string option; swift_prefix: string option; php_class_prefix: string option; php_namespace: string option; php_metadata_namespace: string option; ruby_package: string option; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec OptimizeMode : sig
type t = SPEED | CODE_SIZE | LITE_RUNTIME
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end = struct
type t = SPEED | CODE_SIZE | LITE_RUNTIME
let to_int = function
| SPEED -> 1
| CODE_SIZE -> 2
| LITE_RUNTIME -> 3
let from_int = function
| 1 -> Ok SPEED
| 2 -> Ok CODE_SIZE
| 3 -> Ok LITE_RUNTIME
| n -> Error (`Unknown_enum_value n)
end
let name' () = "descriptor.google.protobuf.FileOptions"
type t = { java_package: string option; java_outer_classname: string option; java_multiple_files: bool; java_generate_equals_and_hash: bool option; java_string_check_utf8: bool; optimize_for: FileOptions.OptimizeMode.t; go_package: string option; cc_generic_services: bool; java_generic_services: bool; py_generic_services: bool; php_generic_services: bool; deprecated: bool; cc_enable_arenas: bool; objc_class_prefix: string option; csharp_namespace: string option; swift_prefix: string option; php_class_prefix: string option; php_namespace: string option; php_metadata_namespace: string option; ruby_package: string option; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { java_package; java_outer_classname; java_multiple_files; java_generate_equals_and_hash; java_string_check_utf8; optimize_for; go_package; cc_generic_services; java_generic_services; py_generic_services; php_generic_services; deprecated; cc_enable_arenas; objc_class_prefix; csharp_namespace; swift_prefix; php_class_prefix; php_namespace; php_metadata_namespace; ruby_package; uninterpreted_option; extensions' } -> f' extensions' java_package java_outer_classname java_multiple_files java_generate_equals_and_hash java_string_check_utf8 optimize_for go_package cc_generic_services java_generic_services py_generic_services php_generic_services deprecated cc_enable_arenas objc_class_prefix csharp_namespace swift_prefix php_class_prefix php_namespace php_metadata_namespace ruby_package uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic_opt (1, string) ^:: basic_opt (8, string) ^:: basic (10, bool, proto2 (false)) ^:: basic_opt (20, bool) ^:: basic (27, bool, proto2 (false)) ^:: basic (9, (enum FileOptions.OptimizeMode.to_int), proto2 (FileOptions.OptimizeMode.SPEED)) ^:: basic_opt (11, string) ^:: basic (16, bool, proto2 (false)) ^:: basic (17, bool, proto2 (false)) ^:: basic (18, bool, proto2 (false)) ^:: basic (42, bool, proto2 (false)) ^:: basic (23, bool, proto2 (false)) ^:: basic (31, bool, proto2 (true)) ^:: basic_opt (36, string) ^:: basic_opt (37, string) ^:: basic_opt (39, string) ^:: basic_opt (40, string) ^:: basic_opt (41, string) ^:: basic_opt (44, string) ^:: basic_opt (45, string) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' java_package java_outer_classname java_multiple_files java_generate_equals_and_hash java_string_check_utf8 optimize_for go_package cc_generic_services java_generic_services py_generic_services php_generic_services deprecated cc_enable_arenas objc_class_prefix csharp_namespace swift_prefix php_class_prefix php_namespace php_metadata_namespace ruby_package uninterpreted_option -> { java_package; java_outer_classname; java_multiple_files; java_generate_equals_and_hash; java_string_check_utf8; optimize_for; go_package; cc_generic_services; java_generic_services; py_generic_services; php_generic_services; deprecated; cc_enable_arenas; objc_class_prefix; csharp_namespace; swift_prefix; php_class_prefix; php_namespace; php_metadata_namespace; ruby_package; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic_opt (1, string) ^:: basic_opt (8, string) ^:: basic (10, bool, proto2 (false)) ^:: basic_opt (20, bool) ^:: basic (27, bool, proto2 (false)) ^:: basic (9, (enum FileOptions.OptimizeMode.from_int), proto2 (FileOptions.OptimizeMode.SPEED)) ^:: basic_opt (11, string) ^:: basic (16, bool, proto2 (false)) ^:: basic (17, bool, proto2 (false)) ^:: basic (18, bool, proto2 (false)) ^:: basic (42, bool, proto2 (false)) ^:: basic (23, bool, proto2 (false)) ^:: basic (31, bool, proto2 (true)) ^:: basic_opt (36, string) ^:: basic_opt (37, string) ^:: basic_opt (39, string) ^:: basic_opt (40, string) ^:: basic_opt (41, string) ^:: basic_opt (44, string) ^:: basic_opt (45, string) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and MessageOptions : sig
val name': unit -> string
type t = { message_set_wire_format: bool; no_standard_descriptor_accessor: bool; deprecated: bool; map_entry: bool option; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.MessageOptions"
type t = { message_set_wire_format: bool; no_standard_descriptor_accessor: bool; deprecated: bool; map_entry: bool option; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option; extensions' } -> f' extensions' message_set_wire_format no_standard_descriptor_accessor deprecated map_entry uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic (1, bool, proto2 (false)) ^:: basic (2, bool, proto2 (false)) ^:: basic (3, bool, proto2 (false)) ^:: basic_opt (7, bool) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' message_set_wire_format no_standard_descriptor_accessor deprecated map_entry uninterpreted_option -> { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic (1, bool, proto2 (false)) ^:: basic (2, bool, proto2 (false)) ^:: basic (3, bool, proto2 (false)) ^:: basic_opt (7, bool) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and FieldOptions : sig
module rec CType : sig
type t = STRING | CORD | STRING_PIECE
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end
and JSType : sig
type t = JS_NORMAL | JS_STRING | JS_NUMBER
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { ctype: FieldOptions.CType.t; packed: bool option; jstype: FieldOptions.JSType.t; lazy': bool; unverified_lazy: bool; deprecated: bool; weak: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec CType : sig
type t = STRING | CORD | STRING_PIECE
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end = struct
type t = STRING | CORD | STRING_PIECE
let to_int = function
| STRING -> 0
| CORD -> 1
| STRING_PIECE -> 2
let from_int = function
| 0 -> Ok STRING
| 1 -> Ok CORD
| 2 -> Ok STRING_PIECE
| n -> Error (`Unknown_enum_value n)
end
and JSType : sig
type t = JS_NORMAL | JS_STRING | JS_NUMBER
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end = struct
type t = JS_NORMAL | JS_STRING | JS_NUMBER
let to_int = function
| JS_NORMAL -> 0
| JS_STRING -> 1
| JS_NUMBER -> 2
let from_int = function
| 0 -> Ok JS_NORMAL
| 1 -> Ok JS_STRING
| 2 -> Ok JS_NUMBER
| n -> Error (`Unknown_enum_value n)
end
let name' () = "descriptor.google.protobuf.FieldOptions"
type t = { ctype: FieldOptions.CType.t; packed: bool option; jstype: FieldOptions.JSType.t; lazy': bool; unverified_lazy: bool; deprecated: bool; weak: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { ctype; packed; jstype; lazy'; unverified_lazy; deprecated; weak; uninterpreted_option; extensions' } -> f' extensions' ctype packed jstype lazy' unverified_lazy deprecated weak uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic (1, (enum FieldOptions.CType.to_int), proto2 (FieldOptions.CType.STRING)) ^:: basic_opt (2, bool) ^:: basic (6, (enum FieldOptions.JSType.to_int), proto2 (FieldOptions.JSType.JS_NORMAL)) ^:: basic (5, bool, proto2 (false)) ^:: basic (15, bool, proto2 (false)) ^:: basic (3, bool, proto2 (false)) ^:: basic (10, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' ctype packed jstype lazy' unverified_lazy deprecated weak uninterpreted_option -> { ctype; packed; jstype; lazy'; unverified_lazy; deprecated; weak; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic (1, (enum FieldOptions.CType.from_int), proto2 (FieldOptions.CType.STRING)) ^:: basic_opt (2, bool) ^:: basic (6, (enum FieldOptions.JSType.from_int), proto2 (FieldOptions.JSType.JS_NORMAL)) ^:: basic (5, bool, proto2 (false)) ^:: basic (15, bool, proto2 (false)) ^:: basic (3, bool, proto2 (false)) ^:: basic (10, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and OneofOptions : sig
val name': unit -> string
type t = { uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.OneofOptions"
type t = { uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { uninterpreted_option; extensions' } -> f' extensions' uninterpreted_option in
let spec = Runtime'.Serialize.C.( repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' uninterpreted_option -> { uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and EnumOptions : sig
val name': unit -> string
type t = { allow_alias: bool option; deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.EnumOptions"
type t = { allow_alias: bool option; deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { allow_alias; deprecated; uninterpreted_option; extensions' } -> f' extensions' allow_alias deprecated uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic_opt (2, bool) ^:: basic (3, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' allow_alias deprecated uninterpreted_option -> { allow_alias; deprecated; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic_opt (2, bool) ^:: basic (3, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and EnumValueOptions : sig
val name': unit -> string
type t = { deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.EnumValueOptions"
type t = { deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { deprecated; uninterpreted_option; extensions' } -> f' extensions' deprecated uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic (1, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' deprecated uninterpreted_option -> { deprecated; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic (1, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and ServiceOptions : sig
val name': unit -> string
type t = { deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.ServiceOptions"
type t = { deprecated: bool; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { deprecated; uninterpreted_option; extensions' } -> f' extensions' deprecated uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic (33, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' deprecated uninterpreted_option -> { deprecated; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic (33, bool, proto2 (false)) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and MethodOptions : sig
module rec IdempotencyLevel : sig
type t = IDEMPOTENCY_UNKNOWN | NO_SIDE_EFFECTS | IDEMPOTENT
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { deprecated: bool; idempotency_level: MethodOptions.IdempotencyLevel.t; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec IdempotencyLevel : sig
type t = IDEMPOTENCY_UNKNOWN | NO_SIDE_EFFECTS | IDEMPOTENT
val to_int: t -> int
val from_int: int -> (t, [> Runtime'.Result.error]) result
end = struct
type t = IDEMPOTENCY_UNKNOWN | NO_SIDE_EFFECTS | IDEMPOTENT
let to_int = function
| IDEMPOTENCY_UNKNOWN -> 0
| NO_SIDE_EFFECTS -> 1
| IDEMPOTENT -> 2
let from_int = function
| 0 -> Ok IDEMPOTENCY_UNKNOWN
| 1 -> Ok NO_SIDE_EFFECTS
| 2 -> Ok IDEMPOTENT
| n -> Error (`Unknown_enum_value n)
end
let name' () = "descriptor.google.protobuf.MethodOptions"
type t = { deprecated: bool; idempotency_level: MethodOptions.IdempotencyLevel.t; uninterpreted_option: UninterpretedOption.t list; extensions': Runtime'.Extensions.t }
let to_proto =
let apply = fun ~f:f' { deprecated; idempotency_level; uninterpreted_option; extensions' } -> f' extensions' deprecated idempotency_level uninterpreted_option in
let spec = Runtime'.Serialize.C.( basic (33, bool, proto2 (false)) ^:: basic (34, (enum MethodOptions.IdempotencyLevel.to_int), proto2 (MethodOptions.IdempotencyLevel.IDEMPOTENCY_UNKNOWN)) ^:: repeated (999, (message (fun t -> UninterpretedOption.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [(1000, 536870912)] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun extensions' deprecated idempotency_level uninterpreted_option -> { deprecated; idempotency_level; uninterpreted_option; extensions' } in
let spec = Runtime'.Deserialize.C.( basic (33, bool, proto2 (false)) ^:: basic (34, (enum MethodOptions.IdempotencyLevel.from_int), proto2 (MethodOptions.IdempotencyLevel.IDEMPOTENCY_UNKNOWN)) ^:: repeated (999, (message (fun t -> UninterpretedOption.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [(1000, 536870912)] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and UninterpretedOption : sig
module rec NamePart : sig
val name': unit -> string
type t = { name_part: string; is_extension: bool }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = { name: UninterpretedOption.NamePart.t list; identifier_value: string option; positive_int_value: int option; negative_int_value: int option; double_value: float option; string_value: bytes option; aggregate_value: string option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec NamePart : sig
val name': unit -> string
type t = { name_part: string; is_extension: bool }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.UninterpretedOption.NamePart"
type t = { name_part: string; is_extension: bool }
let to_proto =
let apply = fun ~f:f' { name_part; is_extension } -> f' [] name_part is_extension in
let spec = Runtime'.Serialize.C.( basic (1, string, required) ^:: basic (2, bool, required) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name_part is_extension -> { name_part; is_extension } in
let spec = Runtime'.Deserialize.C.( basic (1, string, required) ^:: basic (2, bool, required) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
let name' () = "descriptor.google.protobuf.UninterpretedOption"
type t = { name: UninterpretedOption.NamePart.t list; identifier_value: string option; positive_int_value: int option; negative_int_value: int option; double_value: float option; string_value: bytes option; aggregate_value: string option }
let to_proto =
let apply = fun ~f:f' { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value } -> f' [] name identifier_value positive_int_value negative_int_value double_value string_value aggregate_value in
let spec = Runtime'.Serialize.C.( repeated (2, (message (fun t -> UninterpretedOption.NamePart.to_proto t)), not_packed) ^:: basic_opt (3, string) ^:: basic_opt (4, uint64_int) ^:: basic_opt (5, int64_int) ^:: basic_opt (6, double) ^:: basic_opt (7, bytes) ^:: basic_opt (8, string) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions name identifier_value positive_int_value negative_int_value double_value string_value aggregate_value -> { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value } in
let spec = Runtime'.Deserialize.C.( repeated (2, (message (fun t -> UninterpretedOption.NamePart.from_proto t)), not_packed) ^:: basic_opt (3, string) ^:: basic_opt (4, uint64_int) ^:: basic_opt (5, int64_int) ^:: basic_opt (6, double) ^:: basic_opt (7, bytes) ^:: basic_opt (8, string) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and SourceCodeInfo : sig
module rec Location : sig
val name': unit -> string
type t = { path: int list; span: int list; leading_comments: string option; trailing_comments: string option; leading_detached_comments: string list }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = SourceCodeInfo.Location.t list
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec Location : sig
val name': unit -> string
type t = { path: int list; span: int list; leading_comments: string option; trailing_comments: string option; leading_detached_comments: string list }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.SourceCodeInfo.Location"
type t = { path: int list; span: int list; leading_comments: string option; trailing_comments: string option; leading_detached_comments: string list }
let to_proto =
let apply = fun ~f:f' { path; span; ; ; } -> f' [] path span leading_comments trailing_comments leading_detached_comments in
let spec = Runtime'.Serialize.C.( repeated (1, int32_int, packed) ^:: repeated (2, int32_int, packed) ^:: basic_opt (3, string) ^:: basic_opt (4, string) ^:: repeated (6, string, not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions path span -> { path; span; leading_comments; trailing_comments; leading_detached_comments } in
let spec = Runtime'.Deserialize.C.( repeated (1, int32_int, packed) ^:: repeated (2, int32_int, packed) ^:: basic_opt (3, string) ^:: basic_opt (4, string) ^:: repeated (6, string, not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
let name' () = "descriptor.google.protobuf.SourceCodeInfo"
type t = SourceCodeInfo.Location.t list
let to_proto =
let apply = fun ~f a -> f [] a in
let spec = Runtime'.Serialize.C.( repeated (1, (message (fun t -> SourceCodeInfo.Location.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions a -> a in
let spec = Runtime'.Deserialize.C.( repeated (1, (message (fun t -> SourceCodeInfo.Location.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
and GeneratedCodeInfo : sig
module rec Annotation : sig
val name': unit -> string
type t = { path: int list; source_file: string option; begin': int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end
val name': unit -> string
type t = GeneratedCodeInfo.Annotation.t list
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
module rec Annotation : sig
val name': unit -> string
type t = { path: int list; source_file: string option; begin': int option; end': int option }
val to_proto: t -> Runtime'.Writer.t
val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
end = struct
let name' () = "descriptor.google.protobuf.GeneratedCodeInfo.Annotation"
type t = { path: int list; source_file: string option; begin': int option; end': int option }
let to_proto =
let apply = fun ~f:f' { path; source_file; begin'; end' } -> f' [] path source_file begin' end' in
let spec = Runtime'.Serialize.C.( repeated (1, int32_int, packed) ^:: basic_opt (2, string) ^:: basic_opt (3, int32_int) ^:: basic_opt (4, int32_int) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions path source_file begin' end' -> { path; source_file; begin'; end' } in
let spec = Runtime'.Deserialize.C.( repeated (1, int32_int, packed) ^:: basic_opt (2, string) ^:: basic_opt (3, int32_int) ^:: basic_opt (4, int32_int) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
let name' () = "descriptor.google.protobuf.GeneratedCodeInfo"
type t = GeneratedCodeInfo.Annotation.t list
let to_proto =
let apply = fun ~f a -> f [] a in
let spec = Runtime'.Serialize.C.( repeated (1, (message (fun t -> GeneratedCodeInfo.Annotation.to_proto t)), not_packed) ^:: nil ) in
let serialize = Runtime'.Serialize.serialize [] (spec) in
fun t -> apply ~f:serialize t
let from_proto =
let constructor = fun _extensions a -> a in
let spec = Runtime'.Deserialize.C.( repeated (1, (message (fun t -> GeneratedCodeInfo.Annotation.from_proto t)), not_packed) ^:: nil ) in
let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
fun writer -> deserialize writer |> Runtime'.Result.open_error
end
end
end