package protocell

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

Source file google_protobuf_descriptor_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
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
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
[@@@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 File_descriptor_set : sig
  type t = {
    file : File_descriptor_proto.t list;
  }
  [@@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 = {
    file : File_descriptor_proto.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { file } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 1 File_descriptor_proto.to_binary file _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 1 File_descriptor_proto.of_binary _m >>= fun file ->
      Ok { file }

  let rec to_text =
    fun { file } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "file" File_descriptor_proto.to_text file _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "file" File_descriptor_proto.of_text _m >>= fun file ->
      Ok { file }
end

and File_descriptor_proto : sig
  type t = {
    name : string option;
    package : string option;
    dependency : string list;
    public_dependency : int list;
    weak_dependency : int list;
    message_type : Descriptor_proto.t list;
    enum_type : Enum_descriptor_proto.t list;
    service : Service_descriptor_proto.t list;
    extension : Field_descriptor_proto.t list;
    options : File_options.t option;
    source_code_info : Source_code_info.t option;
    syntax : string option;
  }
  [@@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 = {
    name : string option;
    package : string option;
    dependency : string list;
    public_dependency : int list;
    weak_dependency : int list;
    message_type : Descriptor_proto.t list;
    enum_type : Enum_descriptor_proto.t list;
    service : Service_descriptor_proto.t list;
    extension : Field_descriptor_proto.t list;
    options : File_options.t option;
    source_code_info : Source_code_info.t option;
    syntax : string option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.String_t package _o >>= fun () ->
      Bin'.serialize_repeated_field 3 Field'.String_t dependency _o >>= fun () ->
      Bin'.serialize_repeated_field 10 Field'.Int32_t public_dependency _o >>= fun () ->
      Bin'.serialize_repeated_field 11 Field'.Int32_t weak_dependency _o >>= fun () ->
      Bin'.serialize_repeated_user_field 4 Descriptor_proto.to_binary message_type _o >>= fun () ->
      Bin'.serialize_repeated_user_field 5 Enum_descriptor_proto.to_binary enum_type _o >>= fun () ->
      Bin'.serialize_repeated_user_field 6 Service_descriptor_proto.to_binary service _o >>= fun () ->
      Bin'.serialize_repeated_user_field 7 Field_descriptor_proto.to_binary extension _o >>= fun () ->
      Bin'.serialize_user_field 8 File_options.to_binary options _o >>= fun () ->
      Bin'.serialize_user_field 9 Source_code_info.to_binary source_code_info _o >>= fun () ->
      Bin'.serialize_optional_field 12 Field'.String_t syntax _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_optional_field 2 Field'.String_t _m >>= fun package ->
      Bin'.decode_repeated_field 3 Field'.String_t _m >>= fun dependency ->
      Bin'.decode_repeated_field 10 Field'.Int32_t _m >>= fun public_dependency ->
      Bin'.decode_repeated_field 11 Field'.Int32_t _m >>= fun weak_dependency ->
      Bin'.decode_repeated_user_field 4 Descriptor_proto.of_binary _m >>= fun message_type ->
      Bin'.decode_repeated_user_field 5 Enum_descriptor_proto.of_binary _m >>= fun enum_type ->
      Bin'.decode_repeated_user_field 6 Service_descriptor_proto.of_binary _m >>= fun service ->
      Bin'.decode_repeated_user_field 7 Field_descriptor_proto.of_binary _m >>= fun extension ->
      Bin'.decode_user_field 8 File_options.of_binary _m >>= fun options ->
      Bin'.decode_user_field 9 Source_code_info.of_binary _m >>= fun source_code_info ->
      Bin'.decode_optional_field 12 Field'.String_t _m >>= fun syntax ->
      Ok { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax }

  let rec to_text =
    fun { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_optional_field "package" Field'.String_t package _o >>= fun () ->
      Text'.serialize_repeated_field "dependency" Field'.String_t dependency _o >>= fun () ->
      Text'.serialize_repeated_field "public_dependency" Field'.Int32_t public_dependency _o >>= fun () ->
      Text'.serialize_repeated_field "weak_dependency" Field'.Int32_t weak_dependency _o >>= fun () ->
      Text'.serialize_repeated_user_field "message_type" Descriptor_proto.to_text message_type _o >>= fun () ->
      Text'.serialize_repeated_user_field "enum_type" Enum_descriptor_proto.to_text enum_type _o >>= fun () ->
      Text'.serialize_repeated_user_field "service" Service_descriptor_proto.to_text service _o >>= fun () ->
      Text'.serialize_repeated_user_field "extension" Field_descriptor_proto.to_text extension _o >>= fun () ->
      Text'.serialize_user_field "options" File_options.to_text options _o >>= fun () ->
      Text'.serialize_user_field "source_code_info" Source_code_info.to_text source_code_info _o >>= fun () ->
      Text'.serialize_optional_field "syntax" Field'.String_t syntax _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_optional_field "package" Field'.String_t _m >>= fun package ->
      Text'.decode_repeated_field "dependency" Field'.String_t _m >>= fun dependency ->
      Text'.decode_repeated_field "public_dependency" Field'.Int32_t _m >>= fun public_dependency ->
      Text'.decode_repeated_field "weak_dependency" Field'.Int32_t _m >>= fun weak_dependency ->
      Text'.decode_repeated_user_field "message_type" Descriptor_proto.of_text _m >>= fun message_type ->
      Text'.decode_repeated_user_field "enum_type" Enum_descriptor_proto.of_text _m >>= fun enum_type ->
      Text'.decode_repeated_user_field "service" Service_descriptor_proto.of_text _m >>= fun service ->
      Text'.decode_repeated_user_field "extension" Field_descriptor_proto.of_text _m >>= fun extension ->
      Text'.decode_user_field "options" File_options.of_text _m >>= fun options ->
      Text'.decode_user_field "source_code_info" Source_code_info.of_text _m >>= fun source_code_info ->
      Text'.decode_optional_field "syntax" Field'.String_t _m >>= fun syntax ->
      Ok { name; package; dependency; public_dependency; weak_dependency; message_type; enum_type; service; extension; options; source_code_info; syntax }
end

and Descriptor_proto : sig
  module rec Extension_range : sig
    type t = {
      start : int option;
      end' : int option;
      options : Extension_range_options.t option;
    }
    [@@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
  
  and Reserved_range : sig
    type t = {
      start : int option;
      end' : int option;
    }
    [@@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

  type t = {
    name : string option;
    field : Field_descriptor_proto.t list;
    extension : Field_descriptor_proto.t list;
    nested_type : Descriptor_proto.t list;
    enum_type : Enum_descriptor_proto.t list;
    extension_range : Descriptor_proto.Extension_range.t list;
    oneof_decl : Oneof_descriptor_proto.t list;
    options : Message_options.t option;
    reserved_range : Descriptor_proto.Reserved_range.t list;
    reserved_name : string list;
  }
  [@@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
  module rec Extension_range : sig
    type t = {
      start : int option;
      end' : int option;
      options : Extension_range_options.t option;
    }
    [@@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 = {
      start : int option;
      end' : int option;
      options : Extension_range_options.t option;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { start; end'; options } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_optional_field 1 Field'.Int32_t start _o >>= fun () ->
        Bin'.serialize_optional_field 2 Field'.Int32_t end' _o >>= fun () ->
        Bin'.serialize_user_field 3 Extension_range_options.to_binary options _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_optional_field 1 Field'.Int32_t _m >>= fun start ->
        Bin'.decode_optional_field 2 Field'.Int32_t _m >>= fun end' ->
        Bin'.decode_user_field 3 Extension_range_options.of_binary _m >>= fun options ->
        Ok { start; end'; options }
  
    let rec to_text =
      fun { start; end'; options } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_optional_field "start" Field'.Int32_t start _o >>= fun () ->
        Text'.serialize_optional_field "end" Field'.Int32_t end' _o >>= fun () ->
        Text'.serialize_user_field "options" Extension_range_options.to_text options _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_optional_field "start" Field'.Int32_t _m >>= fun start ->
        Text'.decode_optional_field "end" Field'.Int32_t _m >>= fun end' ->
        Text'.decode_user_field "options" Extension_range_options.of_text _m >>= fun options ->
        Ok { start; end'; options }
  end
  
  and Reserved_range : sig
    type t = {
      start : int option;
      end' : int option;
    }
    [@@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 = {
      start : int option;
      end' : int option;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { start; end' } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_optional_field 1 Field'.Int32_t start _o >>= fun () ->
        Bin'.serialize_optional_field 2 Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_optional_field 1 Field'.Int32_t _m >>= fun start ->
        Bin'.decode_optional_field 2 Field'.Int32_t _m >>= fun end' ->
        Ok { start; end' }
  
    let rec to_text =
      fun { start; end' } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_optional_field "start" Field'.Int32_t start _o >>= fun () ->
        Text'.serialize_optional_field "end" Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_optional_field "start" Field'.Int32_t _m >>= fun start ->
        Text'.decode_optional_field "end" Field'.Int32_t _m >>= fun end' ->
        Ok { start; end' }
  end

  type t = {
    name : string option;
    field : Field_descriptor_proto.t list;
    extension : Field_descriptor_proto.t list;
    nested_type : Descriptor_proto.t list;
    enum_type : Enum_descriptor_proto.t list;
    extension_range : Descriptor_proto.Extension_range.t list;
    oneof_decl : Oneof_descriptor_proto.t list;
    options : Message_options.t option;
    reserved_range : Descriptor_proto.Reserved_range.t list;
    reserved_name : string list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_repeated_user_field 2 Field_descriptor_proto.to_binary field _o >>= fun () ->
      Bin'.serialize_repeated_user_field 6 Field_descriptor_proto.to_binary extension _o >>= fun () ->
      Bin'.serialize_repeated_user_field 3 Descriptor_proto.to_binary nested_type _o >>= fun () ->
      Bin'.serialize_repeated_user_field 4 Enum_descriptor_proto.to_binary enum_type _o >>= fun () ->
      Bin'.serialize_repeated_user_field 5 Descriptor_proto.Extension_range.to_binary extension_range _o >>= fun () ->
      Bin'.serialize_repeated_user_field 8 Oneof_descriptor_proto.to_binary oneof_decl _o >>= fun () ->
      Bin'.serialize_user_field 7 Message_options.to_binary options _o >>= fun () ->
      Bin'.serialize_repeated_user_field 9 Descriptor_proto.Reserved_range.to_binary reserved_range _o >>= fun () ->
      Bin'.serialize_repeated_field 10 Field'.String_t reserved_name _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_repeated_user_field 2 Field_descriptor_proto.of_binary _m >>= fun field ->
      Bin'.decode_repeated_user_field 6 Field_descriptor_proto.of_binary _m >>= fun extension ->
      Bin'.decode_repeated_user_field 3 Descriptor_proto.of_binary _m >>= fun nested_type ->
      Bin'.decode_repeated_user_field 4 Enum_descriptor_proto.of_binary _m >>= fun enum_type ->
      Bin'.decode_repeated_user_field 5 Descriptor_proto.Extension_range.of_binary _m >>= fun extension_range ->
      Bin'.decode_repeated_user_field 8 Oneof_descriptor_proto.of_binary _m >>= fun oneof_decl ->
      Bin'.decode_user_field 7 Message_options.of_binary _m >>= fun options ->
      Bin'.decode_repeated_user_field 9 Descriptor_proto.Reserved_range.of_binary _m >>= fun reserved_range ->
      Bin'.decode_repeated_field 10 Field'.String_t _m >>= fun reserved_name ->
      Ok { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name }

  let rec to_text =
    fun { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_repeated_user_field "field" Field_descriptor_proto.to_text field _o >>= fun () ->
      Text'.serialize_repeated_user_field "extension" Field_descriptor_proto.to_text extension _o >>= fun () ->
      Text'.serialize_repeated_user_field "nested_type" Descriptor_proto.to_text nested_type _o >>= fun () ->
      Text'.serialize_repeated_user_field "enum_type" Enum_descriptor_proto.to_text enum_type _o >>= fun () ->
      Text'.serialize_repeated_user_field "extension_range" Descriptor_proto.Extension_range.to_text extension_range _o >>= fun () ->
      Text'.serialize_repeated_user_field "oneof_decl" Oneof_descriptor_proto.to_text oneof_decl _o >>= fun () ->
      Text'.serialize_user_field "options" Message_options.to_text options _o >>= fun () ->
      Text'.serialize_repeated_user_field "reserved_range" Descriptor_proto.Reserved_range.to_text reserved_range _o >>= fun () ->
      Text'.serialize_repeated_field "reserved_name" Field'.String_t reserved_name _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_repeated_user_field "field" Field_descriptor_proto.of_text _m >>= fun field ->
      Text'.decode_repeated_user_field "extension" Field_descriptor_proto.of_text _m >>= fun extension ->
      Text'.decode_repeated_user_field "nested_type" Descriptor_proto.of_text _m >>= fun nested_type ->
      Text'.decode_repeated_user_field "enum_type" Enum_descriptor_proto.of_text _m >>= fun enum_type ->
      Text'.decode_repeated_user_field "extension_range" Descriptor_proto.Extension_range.of_text _m >>= fun extension_range ->
      Text'.decode_repeated_user_field "oneof_decl" Oneof_descriptor_proto.of_text _m >>= fun oneof_decl ->
      Text'.decode_user_field "options" Message_options.of_text _m >>= fun options ->
      Text'.decode_repeated_user_field "reserved_range" Descriptor_proto.Reserved_range.of_text _m >>= fun reserved_range ->
      Text'.decode_repeated_field "reserved_name" Field'.String_t _m >>= fun reserved_name ->
      Ok { name; field; extension; nested_type; enum_type; extension_range; oneof_decl; options; reserved_range; reserved_name }
end

and Extension_range_options : sig
  type t = {
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { uninterpreted_option }

  let rec to_text =
    fun { uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { uninterpreted_option }
end

and Field_descriptor_proto : sig
  module 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
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end
  
  module Label : sig
    type t =
      | Label_optional
      | Label_required
      | Label_repeated
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end

  type t = {
    name : string option;
    number : int option;
    label : Field_descriptor_proto.Label.t;
    type' : Field_descriptor_proto.Type'.t;
    type_name : string option;
    extendee : string option;
    default_value : string option;
    oneof_index : int option;
    json_name : string option;
    options : Field_options.t option;
  }
  [@@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
  module 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
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  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
    [@@deriving eq, show]
  
    let default =
      fun () -> Type_double
  
    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 of_int =
      function
      | 1 -> Some Type_double
      | 2 -> Some Type_float
      | 3 -> Some Type_int64
      | 4 -> Some Type_uint64
      | 5 -> Some Type_int32
      | 6 -> Some Type_fixed64
      | 7 -> Some Type_fixed32
      | 8 -> Some Type_bool
      | 9 -> Some Type_string
      | 10 -> Some Type_group
      | 11 -> Some Type_message
      | 12 -> Some Type_bytes
      | 13 -> Some Type_uint32
      | 14 -> Some Type_enum
      | 15 -> Some Type_sfixed32
      | 16 -> Some Type_sfixed64
      | 17 -> Some Type_sint32
      | 18 -> Some Type_sint64
      | _ -> None
  
    let to_string =
      function
      | Type_double -> "TYPE_DOUBLE"
      | Type_float -> "TYPE_FLOAT"
      | Type_int64 -> "TYPE_INT64"
      | Type_uint64 -> "TYPE_UINT64"
      | Type_int32 -> "TYPE_INT32"
      | Type_fixed64 -> "TYPE_FIXED64"
      | Type_fixed32 -> "TYPE_FIXED32"
      | Type_bool -> "TYPE_BOOL"
      | Type_string -> "TYPE_STRING"
      | Type_group -> "TYPE_GROUP"
      | Type_message -> "TYPE_MESSAGE"
      | Type_bytes -> "TYPE_BYTES"
      | Type_uint32 -> "TYPE_UINT32"
      | Type_enum -> "TYPE_ENUM"
      | Type_sfixed32 -> "TYPE_SFIXED32"
      | Type_sfixed64 -> "TYPE_SFIXED64"
      | Type_sint32 -> "TYPE_SINT32"
      | Type_sint64 -> "TYPE_SINT64"
  
    let of_string =
      function
      | "TYPE_DOUBLE" -> Some Type_double
      | "TYPE_FLOAT" -> Some Type_float
      | "TYPE_INT64" -> Some Type_int64
      | "TYPE_UINT64" -> Some Type_uint64
      | "TYPE_INT32" -> Some Type_int32
      | "TYPE_FIXED64" -> Some Type_fixed64
      | "TYPE_FIXED32" -> Some Type_fixed32
      | "TYPE_BOOL" -> Some Type_bool
      | "TYPE_STRING" -> Some Type_string
      | "TYPE_GROUP" -> Some Type_group
      | "TYPE_MESSAGE" -> Some Type_message
      | "TYPE_BYTES" -> Some Type_bytes
      | "TYPE_UINT32" -> Some Type_uint32
      | "TYPE_ENUM" -> Some Type_enum
      | "TYPE_SFIXED32" -> Some Type_sfixed32
      | "TYPE_SFIXED64" -> Some Type_sfixed64
      | "TYPE_SINT32" -> Some Type_sint32
      | "TYPE_SINT64" -> Some Type_sint64
      | _ -> None
  end
  
  module Label : sig
    type t =
      | Label_optional
      | Label_required
      | Label_repeated
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end = struct
    type t =
      | Label_optional
      | Label_required
      | Label_repeated
    [@@deriving eq, show]
  
    let default =
      fun () -> Label_optional
  
    let to_int =
      function
      | Label_optional -> 1
      | Label_required -> 2
      | Label_repeated -> 3
  
    let of_int =
      function
      | 1 -> Some Label_optional
      | 2 -> Some Label_required
      | 3 -> Some Label_repeated
      | _ -> None
  
    let to_string =
      function
      | Label_optional -> "LABEL_OPTIONAL"
      | Label_required -> "LABEL_REQUIRED"
      | Label_repeated -> "LABEL_REPEATED"
  
    let of_string =
      function
      | "LABEL_OPTIONAL" -> Some Label_optional
      | "LABEL_REQUIRED" -> Some Label_required
      | "LABEL_REPEATED" -> Some Label_repeated
      | _ -> None
  end

  type t = {
    name : string option;
    number : int option;
    label : Field_descriptor_proto.Label.t;
    type' : Field_descriptor_proto.Type'.t;
    type_name : string option;
    extendee : string option;
    default_value : string option;
    oneof_index : int option;
    json_name : string option;
    options : Field_options.t option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.Int32_t number _o >>= fun () ->
      Bin'.serialize_enum_field 4 Field_descriptor_proto.Label.to_int label _o >>= fun () ->
      Bin'.serialize_enum_field 5 Field_descriptor_proto.Type'.to_int type' _o >>= fun () ->
      Bin'.serialize_optional_field 6 Field'.String_t type_name _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.String_t extendee _o >>= fun () ->
      Bin'.serialize_optional_field 7 Field'.String_t default_value _o >>= fun () ->
      Bin'.serialize_optional_field 9 Field'.Int32_t oneof_index _o >>= fun () ->
      Bin'.serialize_optional_field 10 Field'.String_t json_name _o >>= fun () ->
      Bin'.serialize_user_field 8 Field_options.to_binary options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_optional_field 3 Field'.Int32_t _m >>= fun number ->
      Bin'.decode_enum_field 4 Field_descriptor_proto.Label.of_int Field_descriptor_proto.Label.default _m >>= fun label ->
      Bin'.decode_enum_field 5 Field_descriptor_proto.Type'.of_int Field_descriptor_proto.Type'.default _m >>= fun type' ->
      Bin'.decode_optional_field 6 Field'.String_t _m >>= fun type_name ->
      Bin'.decode_optional_field 2 Field'.String_t _m >>= fun extendee ->
      Bin'.decode_optional_field 7 Field'.String_t _m >>= fun default_value ->
      Bin'.decode_optional_field 9 Field'.Int32_t _m >>= fun oneof_index ->
      Bin'.decode_optional_field 10 Field'.String_t _m >>= fun json_name ->
      Bin'.decode_user_field 8 Field_options.of_binary _m >>= fun options ->
      Ok { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options }

  let rec to_text =
    fun { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_optional_field "number" Field'.Int32_t number _o >>= fun () ->
      Text'.serialize_enum_field "label" Field_descriptor_proto.Label.to_string label _o >>= fun () ->
      Text'.serialize_enum_field "type" Field_descriptor_proto.Type'.to_string type' _o >>= fun () ->
      Text'.serialize_optional_field "type_name" Field'.String_t type_name _o >>= fun () ->
      Text'.serialize_optional_field "extendee" Field'.String_t extendee _o >>= fun () ->
      Text'.serialize_optional_field "default_value" Field'.String_t default_value _o >>= fun () ->
      Text'.serialize_optional_field "oneof_index" Field'.Int32_t oneof_index _o >>= fun () ->
      Text'.serialize_optional_field "json_name" Field'.String_t json_name _o >>= fun () ->
      Text'.serialize_user_field "options" Field_options.to_text options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_optional_field "number" Field'.Int32_t _m >>= fun number ->
      Text'.decode_enum_field "label" Field_descriptor_proto.Label.of_string Field_descriptor_proto.Label.default _m >>= fun label ->
      Text'.decode_enum_field "type" Field_descriptor_proto.Type'.of_string Field_descriptor_proto.Type'.default _m >>= fun type' ->
      Text'.decode_optional_field "type_name" Field'.String_t _m >>= fun type_name ->
      Text'.decode_optional_field "extendee" Field'.String_t _m >>= fun extendee ->
      Text'.decode_optional_field "default_value" Field'.String_t _m >>= fun default_value ->
      Text'.decode_optional_field "oneof_index" Field'.Int32_t _m >>= fun oneof_index ->
      Text'.decode_optional_field "json_name" Field'.String_t _m >>= fun json_name ->
      Text'.decode_user_field "options" Field_options.of_text _m >>= fun options ->
      Ok { name; number; label; type'; type_name; extendee; default_value; oneof_index; json_name; options }
end

and Oneof_descriptor_proto : sig
  type t = {
    name : string option;
    options : Oneof_options.t option;
  }
  [@@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 = {
    name : string option;
    options : Oneof_options.t option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; options } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_user_field 2 Oneof_options.to_binary options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_user_field 2 Oneof_options.of_binary _m >>= fun options ->
      Ok { name; options }

  let rec to_text =
    fun { name; options } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_user_field "options" Oneof_options.to_text options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_user_field "options" Oneof_options.of_text _m >>= fun options ->
      Ok { name; options }
end

and Enum_descriptor_proto : sig
  module rec Enum_reserved_range : sig
    type t = {
      start : int option;
      end' : int option;
    }
    [@@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

  type t = {
    name : string option;
    value' : Enum_value_descriptor_proto.t list;
    options : Enum_options.t option;
    reserved_range : Enum_descriptor_proto.Enum_reserved_range.t list;
    reserved_name : string list;
  }
  [@@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
  module rec Enum_reserved_range : sig
    type t = {
      start : int option;
      end' : int option;
    }
    [@@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 = {
      start : int option;
      end' : int option;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { start; end' } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_optional_field 1 Field'.Int32_t start _o >>= fun () ->
        Bin'.serialize_optional_field 2 Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_optional_field 1 Field'.Int32_t _m >>= fun start ->
        Bin'.decode_optional_field 2 Field'.Int32_t _m >>= fun end' ->
        Ok { start; end' }
  
    let rec to_text =
      fun { start; end' } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_optional_field "start" Field'.Int32_t start _o >>= fun () ->
        Text'.serialize_optional_field "end" Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_optional_field "start" Field'.Int32_t _m >>= fun start ->
        Text'.decode_optional_field "end" Field'.Int32_t _m >>= fun end' ->
        Ok { start; end' }
  end

  type t = {
    name : string option;
    value' : Enum_value_descriptor_proto.t list;
    options : Enum_options.t option;
    reserved_range : Enum_descriptor_proto.Enum_reserved_range.t list;
    reserved_name : string list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; value'; options; reserved_range; reserved_name } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_repeated_user_field 2 Enum_value_descriptor_proto.to_binary value' _o >>= fun () ->
      Bin'.serialize_user_field 3 Enum_options.to_binary options _o >>= fun () ->
      Bin'.serialize_repeated_user_field 4 Enum_descriptor_proto.Enum_reserved_range.to_binary reserved_range _o >>= fun () ->
      Bin'.serialize_repeated_field 5 Field'.String_t reserved_name _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_repeated_user_field 2 Enum_value_descriptor_proto.of_binary _m >>= fun value' ->
      Bin'.decode_user_field 3 Enum_options.of_binary _m >>= fun options ->
      Bin'.decode_repeated_user_field 4 Enum_descriptor_proto.Enum_reserved_range.of_binary _m >>= fun reserved_range ->
      Bin'.decode_repeated_field 5 Field'.String_t _m >>= fun reserved_name ->
      Ok { name; value'; options; reserved_range; reserved_name }

  let rec to_text =
    fun { name; value'; options; reserved_range; reserved_name } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_repeated_user_field "value" Enum_value_descriptor_proto.to_text value' _o >>= fun () ->
      Text'.serialize_user_field "options" Enum_options.to_text options _o >>= fun () ->
      Text'.serialize_repeated_user_field "reserved_range" Enum_descriptor_proto.Enum_reserved_range.to_text reserved_range _o >>= fun () ->
      Text'.serialize_repeated_field "reserved_name" Field'.String_t reserved_name _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_repeated_user_field "value" Enum_value_descriptor_proto.of_text _m >>= fun value' ->
      Text'.decode_user_field "options" Enum_options.of_text _m >>= fun options ->
      Text'.decode_repeated_user_field "reserved_range" Enum_descriptor_proto.Enum_reserved_range.of_text _m >>= fun reserved_range ->
      Text'.decode_repeated_field "reserved_name" Field'.String_t _m >>= fun reserved_name ->
      Ok { name; value'; options; reserved_range; reserved_name }
end

and Enum_value_descriptor_proto : sig
  type t = {
    name : string option;
    number : int option;
    options : Enum_value_options.t option;
  }
  [@@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 = {
    name : string option;
    number : int option;
    options : Enum_value_options.t option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; number; options } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.Int32_t number _o >>= fun () ->
      Bin'.serialize_user_field 3 Enum_value_options.to_binary options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_optional_field 2 Field'.Int32_t _m >>= fun number ->
      Bin'.decode_user_field 3 Enum_value_options.of_binary _m >>= fun options ->
      Ok { name; number; options }

  let rec to_text =
    fun { name; number; options } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_optional_field "number" Field'.Int32_t number _o >>= fun () ->
      Text'.serialize_user_field "options" Enum_value_options.to_text options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_optional_field "number" Field'.Int32_t _m >>= fun number ->
      Text'.decode_user_field "options" Enum_value_options.of_text _m >>= fun options ->
      Ok { name; number; options }
end

and Service_descriptor_proto : sig
  type t = {
    name : string option;
    method' : Method_descriptor_proto.t list;
    options : Service_options.t option;
  }
  [@@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 = {
    name : string option;
    method' : Method_descriptor_proto.t list;
    options : Service_options.t option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; method'; options } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_repeated_user_field 2 Method_descriptor_proto.to_binary method' _o >>= fun () ->
      Bin'.serialize_user_field 3 Service_options.to_binary options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_repeated_user_field 2 Method_descriptor_proto.of_binary _m >>= fun method' ->
      Bin'.decode_user_field 3 Service_options.of_binary _m >>= fun options ->
      Ok { name; method'; options }

  let rec to_text =
    fun { name; method'; options } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_repeated_user_field "method" Method_descriptor_proto.to_text method' _o >>= fun () ->
      Text'.serialize_user_field "options" Service_options.to_text options _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_repeated_user_field "method" Method_descriptor_proto.of_text _m >>= fun method' ->
      Text'.decode_user_field "options" Service_options.of_text _m >>= fun options ->
      Ok { name; method'; options }
end

and Method_descriptor_proto : sig
  type t = {
    name : string option;
    input_type : string option;
    output_type : string option;
    options : Method_options.t option;
    client_streaming : bool option;
    server_streaming : bool option;
  }
  [@@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 = {
    name : string option;
    input_type : string option;
    output_type : string option;
    options : Method_options.t option;
    client_streaming : bool option;
    server_streaming : bool option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; input_type; output_type; options; client_streaming; server_streaming } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t name _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.String_t input_type _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.String_t output_type _o >>= fun () ->
      Bin'.serialize_user_field 4 Method_options.to_binary options _o >>= fun () ->
      Bin'.serialize_optional_field 5 Field'.Bool_t client_streaming _o >>= fun () ->
      Bin'.serialize_optional_field 6 Field'.Bool_t server_streaming _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name ->
      Bin'.decode_optional_field 2 Field'.String_t _m >>= fun input_type ->
      Bin'.decode_optional_field 3 Field'.String_t _m >>= fun output_type ->
      Bin'.decode_user_field 4 Method_options.of_binary _m >>= fun options ->
      Bin'.decode_optional_field 5 Field'.Bool_t _m >>= fun client_streaming ->
      Bin'.decode_optional_field 6 Field'.Bool_t _m >>= fun server_streaming ->
      Ok { name; input_type; output_type; options; client_streaming; server_streaming }

  let rec to_text =
    fun { name; input_type; output_type; options; client_streaming; server_streaming } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "name" Field'.String_t name _o >>= fun () ->
      Text'.serialize_optional_field "input_type" Field'.String_t input_type _o >>= fun () ->
      Text'.serialize_optional_field "output_type" Field'.String_t output_type _o >>= fun () ->
      Text'.serialize_user_field "options" Method_options.to_text options _o >>= fun () ->
      Text'.serialize_optional_field "client_streaming" Field'.Bool_t client_streaming _o >>= fun () ->
      Text'.serialize_optional_field "server_streaming" Field'.Bool_t server_streaming _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "name" Field'.String_t _m >>= fun name ->
      Text'.decode_optional_field "input_type" Field'.String_t _m >>= fun input_type ->
      Text'.decode_optional_field "output_type" Field'.String_t _m >>= fun output_type ->
      Text'.decode_user_field "options" Method_options.of_text _m >>= fun options ->
      Text'.decode_optional_field "client_streaming" Field'.Bool_t _m >>= fun client_streaming ->
      Text'.decode_optional_field "server_streaming" Field'.Bool_t _m >>= fun server_streaming ->
      Ok { name; input_type; output_type; options; client_streaming; server_streaming }
end

and File_options : sig
  module Optimize_mode : sig
    type t =
      | Speed
      | Code_size
      | Lite_runtime
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end

  type t = {
    java_package : string option;
    java_outer_classname : string option;
    java_multiple_files : bool option;
    java_generate_equals_and_hash : bool option;
    java_string_check_utf8 : bool option;
    optimize_for : File_options.Optimize_mode.t;
    go_package : string option;
    cc_generic_services : bool option;
    java_generic_services : bool option;
    py_generic_services : bool option;
    php_generic_services : bool option;
    deprecated : bool option;
    cc_enable_arenas : bool option;
    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 : Uninterpreted_option.t list;
  }
  [@@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
  module Optimize_mode : sig
    type t =
      | Speed
      | Code_size
      | Lite_runtime
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end = struct
    type t =
      | Speed
      | Code_size
      | Lite_runtime
    [@@deriving eq, show]
  
    let default =
      fun () -> Speed
  
    let to_int =
      function
      | Speed -> 1
      | Code_size -> 2
      | Lite_runtime -> 3
  
    let of_int =
      function
      | 1 -> Some Speed
      | 2 -> Some Code_size
      | 3 -> Some Lite_runtime
      | _ -> None
  
    let to_string =
      function
      | Speed -> "SPEED"
      | Code_size -> "CODE_SIZE"
      | Lite_runtime -> "LITE_RUNTIME"
  
    let of_string =
      function
      | "SPEED" -> Some Speed
      | "CODE_SIZE" -> Some Code_size
      | "LITE_RUNTIME" -> Some Lite_runtime
      | _ -> None
  end

  type t = {
    java_package : string option;
    java_outer_classname : string option;
    java_multiple_files : bool option;
    java_generate_equals_and_hash : bool option;
    java_string_check_utf8 : bool option;
    optimize_for : File_options.Optimize_mode.t;
    go_package : string option;
    cc_generic_services : bool option;
    java_generic_services : bool option;
    py_generic_services : bool option;
    php_generic_services : bool option;
    deprecated : bool option;
    cc_enable_arenas : bool option;
    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 : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { 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 } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.String_t java_package _o >>= fun () ->
      Bin'.serialize_optional_field 8 Field'.String_t java_outer_classname _o >>= fun () ->
      Bin'.serialize_optional_field 10 Field'.Bool_t java_multiple_files _o >>= fun () ->
      Bin'.serialize_optional_field 20 Field'.Bool_t java_generate_equals_and_hash _o >>= fun () ->
      Bin'.serialize_optional_field 27 Field'.Bool_t java_string_check_utf8 _o >>= fun () ->
      Bin'.serialize_enum_field 9 File_options.Optimize_mode.to_int optimize_for _o >>= fun () ->
      Bin'.serialize_optional_field 11 Field'.String_t go_package _o >>= fun () ->
      Bin'.serialize_optional_field 16 Field'.Bool_t cc_generic_services _o >>= fun () ->
      Bin'.serialize_optional_field 17 Field'.Bool_t java_generic_services _o >>= fun () ->
      Bin'.serialize_optional_field 18 Field'.Bool_t py_generic_services _o >>= fun () ->
      Bin'.serialize_optional_field 42 Field'.Bool_t php_generic_services _o >>= fun () ->
      Bin'.serialize_optional_field 23 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_optional_field 31 Field'.Bool_t cc_enable_arenas _o >>= fun () ->
      Bin'.serialize_optional_field 36 Field'.String_t objc_class_prefix _o >>= fun () ->
      Bin'.serialize_optional_field 37 Field'.String_t csharp_namespace _o >>= fun () ->
      Bin'.serialize_optional_field 39 Field'.String_t swift_prefix _o >>= fun () ->
      Bin'.serialize_optional_field 40 Field'.String_t php_class_prefix _o >>= fun () ->
      Bin'.serialize_optional_field 41 Field'.String_t php_namespace _o >>= fun () ->
      Bin'.serialize_optional_field 44 Field'.String_t php_metadata_namespace _o >>= fun () ->
      Bin'.serialize_optional_field 45 Field'.String_t ruby_package _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.String_t _m >>= fun java_package ->
      Bin'.decode_optional_field 8 Field'.String_t _m >>= fun java_outer_classname ->
      Bin'.decode_optional_field 10 Field'.Bool_t _m >>= fun java_multiple_files ->
      Bin'.decode_optional_field 20 Field'.Bool_t _m >>= fun java_generate_equals_and_hash ->
      Bin'.decode_optional_field 27 Field'.Bool_t _m >>= fun java_string_check_utf8 ->
      Bin'.decode_enum_field 9 File_options.Optimize_mode.of_int File_options.Optimize_mode.default _m >>= fun optimize_for ->
      Bin'.decode_optional_field 11 Field'.String_t _m >>= fun go_package ->
      Bin'.decode_optional_field 16 Field'.Bool_t _m >>= fun cc_generic_services ->
      Bin'.decode_optional_field 17 Field'.Bool_t _m >>= fun java_generic_services ->
      Bin'.decode_optional_field 18 Field'.Bool_t _m >>= fun py_generic_services ->
      Bin'.decode_optional_field 42 Field'.Bool_t _m >>= fun php_generic_services ->
      Bin'.decode_optional_field 23 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_optional_field 31 Field'.Bool_t _m >>= fun cc_enable_arenas ->
      Bin'.decode_optional_field 36 Field'.String_t _m >>= fun objc_class_prefix ->
      Bin'.decode_optional_field 37 Field'.String_t _m >>= fun csharp_namespace ->
      Bin'.decode_optional_field 39 Field'.String_t _m >>= fun swift_prefix ->
      Bin'.decode_optional_field 40 Field'.String_t _m >>= fun php_class_prefix ->
      Bin'.decode_optional_field 41 Field'.String_t _m >>= fun php_namespace ->
      Bin'.decode_optional_field 44 Field'.String_t _m >>= fun php_metadata_namespace ->
      Bin'.decode_optional_field 45 Field'.String_t _m >>= fun ruby_package ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { 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 }

  let rec to_text =
    fun { 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 } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "java_package" Field'.String_t java_package _o >>= fun () ->
      Text'.serialize_optional_field "java_outer_classname" Field'.String_t java_outer_classname _o >>= fun () ->
      Text'.serialize_optional_field "java_multiple_files" Field'.Bool_t java_multiple_files _o >>= fun () ->
      Text'.serialize_optional_field "java_generate_equals_and_hash" Field'.Bool_t java_generate_equals_and_hash _o >>= fun () ->
      Text'.serialize_optional_field "java_string_check_utf8" Field'.Bool_t java_string_check_utf8 _o >>= fun () ->
      Text'.serialize_enum_field "optimize_for" File_options.Optimize_mode.to_string optimize_for _o >>= fun () ->
      Text'.serialize_optional_field "go_package" Field'.String_t go_package _o >>= fun () ->
      Text'.serialize_optional_field "cc_generic_services" Field'.Bool_t cc_generic_services _o >>= fun () ->
      Text'.serialize_optional_field "java_generic_services" Field'.Bool_t java_generic_services _o >>= fun () ->
      Text'.serialize_optional_field "py_generic_services" Field'.Bool_t py_generic_services _o >>= fun () ->
      Text'.serialize_optional_field "php_generic_services" Field'.Bool_t php_generic_services _o >>= fun () ->
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_optional_field "cc_enable_arenas" Field'.Bool_t cc_enable_arenas _o >>= fun () ->
      Text'.serialize_optional_field "objc_class_prefix" Field'.String_t objc_class_prefix _o >>= fun () ->
      Text'.serialize_optional_field "csharp_namespace" Field'.String_t csharp_namespace _o >>= fun () ->
      Text'.serialize_optional_field "swift_prefix" Field'.String_t swift_prefix _o >>= fun () ->
      Text'.serialize_optional_field "php_class_prefix" Field'.String_t php_class_prefix _o >>= fun () ->
      Text'.serialize_optional_field "php_namespace" Field'.String_t php_namespace _o >>= fun () ->
      Text'.serialize_optional_field "php_metadata_namespace" Field'.String_t php_metadata_namespace _o >>= fun () ->
      Text'.serialize_optional_field "ruby_package" Field'.String_t ruby_package _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "java_package" Field'.String_t _m >>= fun java_package ->
      Text'.decode_optional_field "java_outer_classname" Field'.String_t _m >>= fun java_outer_classname ->
      Text'.decode_optional_field "java_multiple_files" Field'.Bool_t _m >>= fun java_multiple_files ->
      Text'.decode_optional_field "java_generate_equals_and_hash" Field'.Bool_t _m >>= fun java_generate_equals_and_hash ->
      Text'.decode_optional_field "java_string_check_utf8" Field'.Bool_t _m >>= fun java_string_check_utf8 ->
      Text'.decode_enum_field "optimize_for" File_options.Optimize_mode.of_string File_options.Optimize_mode.default _m >>= fun optimize_for ->
      Text'.decode_optional_field "go_package" Field'.String_t _m >>= fun go_package ->
      Text'.decode_optional_field "cc_generic_services" Field'.Bool_t _m >>= fun cc_generic_services ->
      Text'.decode_optional_field "java_generic_services" Field'.Bool_t _m >>= fun java_generic_services ->
      Text'.decode_optional_field "py_generic_services" Field'.Bool_t _m >>= fun py_generic_services ->
      Text'.decode_optional_field "php_generic_services" Field'.Bool_t _m >>= fun php_generic_services ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_optional_field "cc_enable_arenas" Field'.Bool_t _m >>= fun cc_enable_arenas ->
      Text'.decode_optional_field "objc_class_prefix" Field'.String_t _m >>= fun objc_class_prefix ->
      Text'.decode_optional_field "csharp_namespace" Field'.String_t _m >>= fun csharp_namespace ->
      Text'.decode_optional_field "swift_prefix" Field'.String_t _m >>= fun swift_prefix ->
      Text'.decode_optional_field "php_class_prefix" Field'.String_t _m >>= fun php_class_prefix ->
      Text'.decode_optional_field "php_namespace" Field'.String_t _m >>= fun php_namespace ->
      Text'.decode_optional_field "php_metadata_namespace" Field'.String_t _m >>= fun php_metadata_namespace ->
      Text'.decode_optional_field "ruby_package" Field'.String_t _m >>= fun ruby_package ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { 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 }
end

and Message_options : sig
  type t = {
    message_set_wire_format : bool option;
    no_standard_descriptor_accessor : bool option;
    deprecated : bool option;
    map_entry : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    message_set_wire_format : bool option;
    no_standard_descriptor_accessor : bool option;
    deprecated : bool option;
    map_entry : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.Bool_t message_set_wire_format _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.Bool_t no_standard_descriptor_accessor _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_optional_field 7 Field'.Bool_t map_entry _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.Bool_t _m >>= fun message_set_wire_format ->
      Bin'.decode_optional_field 2 Field'.Bool_t _m >>= fun no_standard_descriptor_accessor ->
      Bin'.decode_optional_field 3 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_optional_field 7 Field'.Bool_t _m >>= fun map_entry ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option }

  let rec to_text =
    fun { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "message_set_wire_format" Field'.Bool_t message_set_wire_format _o >>= fun () ->
      Text'.serialize_optional_field "no_standard_descriptor_accessor" Field'.Bool_t no_standard_descriptor_accessor _o >>= fun () ->
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_optional_field "map_entry" Field'.Bool_t map_entry _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "message_set_wire_format" Field'.Bool_t _m >>= fun message_set_wire_format ->
      Text'.decode_optional_field "no_standard_descriptor_accessor" Field'.Bool_t _m >>= fun no_standard_descriptor_accessor ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_optional_field "map_entry" Field'.Bool_t _m >>= fun map_entry ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { message_set_wire_format; no_standard_descriptor_accessor; deprecated; map_entry; uninterpreted_option }
end

and Field_options : sig
  module C_type : sig
    type t =
      | String
      | Cord
      | String_piece
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end
  
  module J_s_type : sig
    type t =
      | Js_normal
      | Js_string
      | Js_number
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end

  type t = {
    ctype : Field_options.C_type.t;
    packed : bool option;
    jstype : Field_options.J_s_type.t;
    lazy' : bool option;
    deprecated : bool option;
    weak : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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
  module C_type : sig
    type t =
      | String
      | Cord
      | String_piece
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end = struct
    type t =
      | String
      | Cord
      | String_piece
    [@@deriving eq, show]
  
    let default =
      fun () -> String
  
    let to_int =
      function
      | String -> 0
      | Cord -> 1
      | String_piece -> 2
  
    let of_int =
      function
      | 0 -> Some String
      | 1 -> Some Cord
      | 2 -> Some String_piece
      | _ -> None
  
    let to_string =
      function
      | String -> "STRING"
      | Cord -> "CORD"
      | String_piece -> "STRING_PIECE"
  
    let of_string =
      function
      | "STRING" -> Some String
      | "CORD" -> Some Cord
      | "STRING_PIECE" -> Some String_piece
      | _ -> None
  end
  
  module J_s_type : sig
    type t =
      | Js_normal
      | Js_string
      | Js_number
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end = struct
    type t =
      | Js_normal
      | Js_string
      | Js_number
    [@@deriving eq, show]
  
    let default =
      fun () -> Js_normal
  
    let to_int =
      function
      | Js_normal -> 0
      | Js_string -> 1
      | Js_number -> 2
  
    let of_int =
      function
      | 0 -> Some Js_normal
      | 1 -> Some Js_string
      | 2 -> Some Js_number
      | _ -> None
  
    let to_string =
      function
      | Js_normal -> "JS_NORMAL"
      | Js_string -> "JS_STRING"
      | Js_number -> "JS_NUMBER"
  
    let of_string =
      function
      | "JS_NORMAL" -> Some Js_normal
      | "JS_STRING" -> Some Js_string
      | "JS_NUMBER" -> Some Js_number
      | _ -> None
  end

  type t = {
    ctype : Field_options.C_type.t;
    packed : bool option;
    jstype : Field_options.J_s_type.t;
    lazy' : bool option;
    deprecated : bool option;
    weak : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { ctype; packed; jstype; lazy'; deprecated; weak; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_enum_field 1 Field_options.C_type.to_int ctype _o >>= fun () ->
      Bin'.serialize_optional_field 2 Field'.Bool_t packed _o >>= fun () ->
      Bin'.serialize_enum_field 6 Field_options.J_s_type.to_int jstype _o >>= fun () ->
      Bin'.serialize_optional_field 5 Field'.Bool_t lazy' _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_optional_field 10 Field'.Bool_t weak _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_enum_field 1 Field_options.C_type.of_int Field_options.C_type.default _m >>= fun ctype ->
      Bin'.decode_optional_field 2 Field'.Bool_t _m >>= fun packed ->
      Bin'.decode_enum_field 6 Field_options.J_s_type.of_int Field_options.J_s_type.default _m >>= fun jstype ->
      Bin'.decode_optional_field 5 Field'.Bool_t _m >>= fun lazy' ->
      Bin'.decode_optional_field 3 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_optional_field 10 Field'.Bool_t _m >>= fun weak ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { ctype; packed; jstype; lazy'; deprecated; weak; uninterpreted_option }

  let rec to_text =
    fun { ctype; packed; jstype; lazy'; deprecated; weak; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_enum_field "ctype" Field_options.C_type.to_string ctype _o >>= fun () ->
      Text'.serialize_optional_field "packed" Field'.Bool_t packed _o >>= fun () ->
      Text'.serialize_enum_field "jstype" Field_options.J_s_type.to_string jstype _o >>= fun () ->
      Text'.serialize_optional_field "lazy" Field'.Bool_t lazy' _o >>= fun () ->
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_optional_field "weak" Field'.Bool_t weak _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_enum_field "ctype" Field_options.C_type.of_string Field_options.C_type.default _m >>= fun ctype ->
      Text'.decode_optional_field "packed" Field'.Bool_t _m >>= fun packed ->
      Text'.decode_enum_field "jstype" Field_options.J_s_type.of_string Field_options.J_s_type.default _m >>= fun jstype ->
      Text'.decode_optional_field "lazy" Field'.Bool_t _m >>= fun lazy' ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_optional_field "weak" Field'.Bool_t _m >>= fun weak ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { ctype; packed; jstype; lazy'; deprecated; weak; uninterpreted_option }
end

and Oneof_options : sig
  type t = {
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { uninterpreted_option }

  let rec to_text =
    fun { uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { uninterpreted_option }
end

and Enum_options : sig
  type t = {
    allow_alias : bool option;
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    allow_alias : bool option;
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { allow_alias; deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 2 Field'.Bool_t allow_alias _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 2 Field'.Bool_t _m >>= fun allow_alias ->
      Bin'.decode_optional_field 3 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { allow_alias; deprecated; uninterpreted_option }

  let rec to_text =
    fun { allow_alias; deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "allow_alias" Field'.Bool_t allow_alias _o >>= fun () ->
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "allow_alias" Field'.Bool_t _m >>= fun allow_alias ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { allow_alias; deprecated; uninterpreted_option }
end

and Enum_value_options : sig
  type t = {
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 1 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 1 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { deprecated; uninterpreted_option }

  let rec to_text =
    fun { deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { deprecated; uninterpreted_option }
end

and Service_options : sig
  type t = {
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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 = {
    deprecated : bool option;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 33 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 33 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { deprecated; uninterpreted_option }

  let rec to_text =
    fun { deprecated; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { deprecated; uninterpreted_option }
end

and Method_options : sig
  module Idempotency_level : sig
    type t =
      | Idempotency_unknown
      | No_side_effects
      | Idempotent
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end

  type t = {
    deprecated : bool option;
    idempotency_level : Method_options.Idempotency_level.t;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@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
  module Idempotency_level : sig
    type t =
      | Idempotency_unknown
      | No_side_effects
      | Idempotent
    [@@deriving eq, show]
  
    val default : unit -> t
  
    val to_int : t -> int
  
    val of_int : int -> t option
  
    val to_string : t -> string
  
    val of_string : string -> t option
  end = struct
    type t =
      | Idempotency_unknown
      | No_side_effects
      | Idempotent
    [@@deriving eq, show]
  
    let default =
      fun () -> Idempotency_unknown
  
    let to_int =
      function
      | Idempotency_unknown -> 0
      | No_side_effects -> 1
      | Idempotent -> 2
  
    let of_int =
      function
      | 0 -> Some Idempotency_unknown
      | 1 -> Some No_side_effects
      | 2 -> Some Idempotent
      | _ -> None
  
    let to_string =
      function
      | Idempotency_unknown -> "IDEMPOTENCY_UNKNOWN"
      | No_side_effects -> "NO_SIDE_EFFECTS"
      | Idempotent -> "IDEMPOTENT"
  
    let of_string =
      function
      | "IDEMPOTENCY_UNKNOWN" -> Some Idempotency_unknown
      | "NO_SIDE_EFFECTS" -> Some No_side_effects
      | "IDEMPOTENT" -> Some Idempotent
      | _ -> None
  end

  type t = {
    deprecated : bool option;
    idempotency_level : Method_options.Idempotency_level.t;
    uninterpreted_option : Uninterpreted_option.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { deprecated; idempotency_level; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_optional_field 33 Field'.Bool_t deprecated _o >>= fun () ->
      Bin'.serialize_enum_field 34 Method_options.Idempotency_level.to_int idempotency_level _o >>= fun () ->
      Bin'.serialize_repeated_user_field 999 Uninterpreted_option.to_binary uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_optional_field 33 Field'.Bool_t _m >>= fun deprecated ->
      Bin'.decode_enum_field 34 Method_options.Idempotency_level.of_int Method_options.Idempotency_level.default _m >>= fun idempotency_level ->
      Bin'.decode_repeated_user_field 999 Uninterpreted_option.of_binary _m >>= fun uninterpreted_option ->
      Ok { deprecated; idempotency_level; uninterpreted_option }

  let rec to_text =
    fun { deprecated; idempotency_level; uninterpreted_option } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_optional_field "deprecated" Field'.Bool_t deprecated _o >>= fun () ->
      Text'.serialize_enum_field "idempotency_level" Method_options.Idempotency_level.to_string idempotency_level _o >>= fun () ->
      Text'.serialize_repeated_user_field "uninterpreted_option" Uninterpreted_option.to_text uninterpreted_option _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_optional_field "deprecated" Field'.Bool_t _m >>= fun deprecated ->
      Text'.decode_enum_field "idempotency_level" Method_options.Idempotency_level.of_string Method_options.Idempotency_level.default _m >>= fun idempotency_level ->
      Text'.decode_repeated_user_field "uninterpreted_option" Uninterpreted_option.of_text _m >>= fun uninterpreted_option ->
      Ok { deprecated; idempotency_level; uninterpreted_option }
end

and Uninterpreted_option : sig
  module rec Name_part : sig
    type t = {
      name_part : string option;
      is_extension : bool option;
    }
    [@@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

  type t = {
    name : Uninterpreted_option.Name_part.t list;
    identifier_value : string option;
    positive_int_value : int option;
    negative_int_value : int option;
    double_value : float option;
    string_value : string option;
    aggregate_value : string option;
  }
  [@@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
  module rec Name_part : sig
    type t = {
      name_part : string option;
      is_extension : bool option;
    }
    [@@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 = {
      name_part : string option;
      is_extension : bool option;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { name_part; is_extension } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_optional_field 1 Field'.String_t name_part _o >>= fun () ->
        Bin'.serialize_optional_field 2 Field'.Bool_t is_extension _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_optional_field 1 Field'.String_t _m >>= fun name_part ->
        Bin'.decode_optional_field 2 Field'.Bool_t _m >>= fun is_extension ->
        Ok { name_part; is_extension }
  
    let rec to_text =
      fun { name_part; is_extension } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_optional_field "name_part" Field'.String_t name_part _o >>= fun () ->
        Text'.serialize_optional_field "is_extension" Field'.Bool_t is_extension _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_optional_field "name_part" Field'.String_t _m >>= fun name_part ->
        Text'.decode_optional_field "is_extension" Field'.Bool_t _m >>= fun is_extension ->
        Ok { name_part; is_extension }
  end

  type t = {
    name : Uninterpreted_option.Name_part.t list;
    identifier_value : string option;
    positive_int_value : int option;
    negative_int_value : int option;
    double_value : float option;
    string_value : string option;
    aggregate_value : string option;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 2 Uninterpreted_option.Name_part.to_binary name _o >>= fun () ->
      Bin'.serialize_optional_field 3 Field'.String_t identifier_value _o >>= fun () ->
      Bin'.serialize_optional_field 4 Field'.Uint64_t positive_int_value _o >>= fun () ->
      Bin'.serialize_optional_field 5 Field'.Int64_t negative_int_value _o >>= fun () ->
      Bin'.serialize_optional_field 6 Field'.Double_t double_value _o >>= fun () ->
      Bin'.serialize_optional_field 7 Field'.Bytes_t string_value _o >>= fun () ->
      Bin'.serialize_optional_field 8 Field'.String_t aggregate_value _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 2 Uninterpreted_option.Name_part.of_binary _m >>= fun name ->
      Bin'.decode_optional_field 3 Field'.String_t _m >>= fun identifier_value ->
      Bin'.decode_optional_field 4 Field'.Uint64_t _m >>= fun positive_int_value ->
      Bin'.decode_optional_field 5 Field'.Int64_t _m >>= fun negative_int_value ->
      Bin'.decode_optional_field 6 Field'.Double_t _m >>= fun double_value ->
      Bin'.decode_optional_field 7 Field'.Bytes_t _m >>= fun string_value ->
      Bin'.decode_optional_field 8 Field'.String_t _m >>= fun aggregate_value ->
      Ok { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value }

  let rec to_text =
    fun { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "name" Uninterpreted_option.Name_part.to_text name _o >>= fun () ->
      Text'.serialize_optional_field "identifier_value" Field'.String_t identifier_value _o >>= fun () ->
      Text'.serialize_optional_field "positive_int_value" Field'.Uint64_t positive_int_value _o >>= fun () ->
      Text'.serialize_optional_field "negative_int_value" Field'.Int64_t negative_int_value _o >>= fun () ->
      Text'.serialize_optional_field "double_value" Field'.Double_t double_value _o >>= fun () ->
      Text'.serialize_optional_field "string_value" Field'.Bytes_t string_value _o >>= fun () ->
      Text'.serialize_optional_field "aggregate_value" Field'.String_t aggregate_value _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "name" Uninterpreted_option.Name_part.of_text _m >>= fun name ->
      Text'.decode_optional_field "identifier_value" Field'.String_t _m >>= fun identifier_value ->
      Text'.decode_optional_field "positive_int_value" Field'.Uint64_t _m >>= fun positive_int_value ->
      Text'.decode_optional_field "negative_int_value" Field'.Int64_t _m >>= fun negative_int_value ->
      Text'.decode_optional_field "double_value" Field'.Double_t _m >>= fun double_value ->
      Text'.decode_optional_field "string_value" Field'.Bytes_t _m >>= fun string_value ->
      Text'.decode_optional_field "aggregate_value" Field'.String_t _m >>= fun aggregate_value ->
      Ok { name; identifier_value; positive_int_value; negative_int_value; double_value; string_value; aggregate_value }
end

and Source_code_info : sig
  module rec Location : sig
    type t = {
      path : int list;
      span : int list;
      leading_comments : string option;
      trailing_comments : string option;
      leading_detached_comments : string list;
    }
    [@@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

  type t = {
    location : Source_code_info.Location.t list;
  }
  [@@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
  module rec Location : sig
    type t = {
      path : int list;
      span : int list;
      leading_comments : string option;
      trailing_comments : string option;
      leading_detached_comments : string list;
    }
    [@@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 = {
      path : int list;
      span : int list;
      leading_comments : string option;
      trailing_comments : string option;
      leading_detached_comments : string list;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { path; span; leading_comments; trailing_comments; leading_detached_comments } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_repeated_field 1 Field'.Int32_t path _o >>= fun () ->
        Bin'.serialize_repeated_field 2 Field'.Int32_t span _o >>= fun () ->
        Bin'.serialize_optional_field 3 Field'.String_t leading_comments _o >>= fun () ->
        Bin'.serialize_optional_field 4 Field'.String_t trailing_comments _o >>= fun () ->
        Bin'.serialize_repeated_field 6 Field'.String_t leading_detached_comments _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_repeated_field 1 Field'.Int32_t _m >>= fun path ->
        Bin'.decode_repeated_field 2 Field'.Int32_t _m >>= fun span ->
        Bin'.decode_optional_field 3 Field'.String_t _m >>= fun leading_comments ->
        Bin'.decode_optional_field 4 Field'.String_t _m >>= fun trailing_comments ->
        Bin'.decode_repeated_field 6 Field'.String_t _m >>= fun leading_detached_comments ->
        Ok { path; span; leading_comments; trailing_comments; leading_detached_comments }
  
    let rec to_text =
      fun { path; span; leading_comments; trailing_comments; leading_detached_comments } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_repeated_field "path" Field'.Int32_t path _o >>= fun () ->
        Text'.serialize_repeated_field "span" Field'.Int32_t span _o >>= fun () ->
        Text'.serialize_optional_field "leading_comments" Field'.String_t leading_comments _o >>= fun () ->
        Text'.serialize_optional_field "trailing_comments" Field'.String_t trailing_comments _o >>= fun () ->
        Text'.serialize_repeated_field "leading_detached_comments" Field'.String_t leading_detached_comments _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_repeated_field "path" Field'.Int32_t _m >>= fun path ->
        Text'.decode_repeated_field "span" Field'.Int32_t _m >>= fun span ->
        Text'.decode_optional_field "leading_comments" Field'.String_t _m >>= fun leading_comments ->
        Text'.decode_optional_field "trailing_comments" Field'.String_t _m >>= fun trailing_comments ->
        Text'.decode_repeated_field "leading_detached_comments" Field'.String_t _m >>= fun leading_detached_comments ->
        Ok { path; span; leading_comments; trailing_comments; leading_detached_comments }
  end

  type t = {
    location : Source_code_info.Location.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { location } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 1 Source_code_info.Location.to_binary location _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 1 Source_code_info.Location.of_binary _m >>= fun location ->
      Ok { location }

  let rec to_text =
    fun { location } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "location" Source_code_info.Location.to_text location _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "location" Source_code_info.Location.of_text _m >>= fun location ->
      Ok { location }
end

and Generated_code_info : sig
  module rec Annotation : sig
    type t = {
      path : int list;
      source_file : string option;
      begin' : int option;
      end' : int option;
    }
    [@@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

  type t = {
    annotation : Generated_code_info.Annotation.t list;
  }
  [@@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
  module rec Annotation : sig
    type t = {
      path : int list;
      source_file : string option;
      begin' : int option;
      end' : int option;
    }
    [@@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 = {
      path : int list;
      source_file : string option;
      begin' : int option;
      end' : int option;
    }
    [@@deriving eq, show]
  
    let rec to_binary =
      fun { path; source_file; begin'; end' } ->
        let _o = Runtime.Byte_output.create () in
        Bin'.serialize_repeated_field 1 Field'.Int32_t path _o >>= fun () ->
        Bin'.serialize_optional_field 2 Field'.String_t source_file _o >>= fun () ->
        Bin'.serialize_optional_field 3 Field'.Int32_t begin' _o >>= fun () ->
        Bin'.serialize_optional_field 4 Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_binary =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Bin'.deserialize_message >>= fun _m ->
        Bin'.decode_repeated_field 1 Field'.Int32_t _m >>= fun path ->
        Bin'.decode_optional_field 2 Field'.String_t _m >>= fun source_file ->
        Bin'.decode_optional_field 3 Field'.Int32_t _m >>= fun begin' ->
        Bin'.decode_optional_field 4 Field'.Int32_t _m >>= fun end' ->
        Ok { path; source_file; begin'; end' }
  
    let rec to_text =
      fun { path; source_file; begin'; end' } ->
        let _o = Runtime.Byte_output.create () in
        Text'.serialize_repeated_field "path" Field'.Int32_t path _o >>= fun () ->
        Text'.serialize_optional_field "source_file" Field'.String_t source_file _o >>= fun () ->
        Text'.serialize_optional_field "begin" Field'.Int32_t begin' _o >>= fun () ->
        Text'.serialize_optional_field "end" Field'.Int32_t end' _o >>= fun () ->
        Ok (Runtime.Byte_output.contents _o)
  
    let rec of_text =
      fun input' ->
        Ok (Runtime.Byte_input.create input') >>=
        Text'.deserialize_message >>= fun _m ->
        Text'.decode_repeated_field "path" Field'.Int32_t _m >>= fun path ->
        Text'.decode_optional_field "source_file" Field'.String_t _m >>= fun source_file ->
        Text'.decode_optional_field "begin" Field'.Int32_t _m >>= fun begin' ->
        Text'.decode_optional_field "end" Field'.Int32_t _m >>= fun end' ->
        Ok { path; source_file; begin'; end' }
  end

  type t = {
    annotation : Generated_code_info.Annotation.t list;
  }
  [@@deriving eq, show]

  let rec to_binary =
    fun { annotation } ->
      let _o = Runtime.Byte_output.create () in
      Bin'.serialize_repeated_user_field 1 Generated_code_info.Annotation.to_binary annotation _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_binary =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Bin'.deserialize_message >>= fun _m ->
      Bin'.decode_repeated_user_field 1 Generated_code_info.Annotation.of_binary _m >>= fun annotation ->
      Ok { annotation }

  let rec to_text =
    fun { annotation } ->
      let _o = Runtime.Byte_output.create () in
      Text'.serialize_repeated_user_field "annotation" Generated_code_info.Annotation.to_text annotation _o >>= fun () ->
      Ok (Runtime.Byte_output.contents _o)

  let rec of_text =
    fun input' ->
      Ok (Runtime.Byte_input.create input') >>=
      Text'.deserialize_message >>= fun _m ->
      Text'.decode_repeated_user_field "annotation" Generated_code_info.Annotation.of_text _m >>= fun annotation ->
      Ok { annotation }
end
OCaml

Innovation. Community. Security.