package ocaml-protoc-plugin

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

Source file api.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
(************************************************)
(*       AUTOGENERATED FILE - DO NOT EDIT!      *)
(************************************************)
(* Generated by: ocaml-protoc-plugin            *)
(* https://github.com/issuu/ocaml-protoc-plugin *)
(************************************************)
(*
   Source: google/protobuf/api.proto
   Syntax: proto3 
   Parameters:
     debug=false
     annot=''
     opens=[]
     int64_as_int=true
     int32_as_int=true
     fixed_as_int=false
     singleton_record=false
*)

open Ocaml_protoc_plugin.Runtime [@@warning "-33"]
(**/**)
module Imported'modules = struct
  module Source_context = Source_context
  module Type = Type
end
(**/**)
module Google = struct
  module Protobuf = struct
    module rec Api : sig
      val name': unit -> string
      type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t } 
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
    end = struct 
      let name' () = "api.google.protobuf.Api"
      type t = { name: string; methods: Method.t list; options: Imported'modules.Type.Google.Protobuf.Option.t list; version: string; source_context: Imported'modules.Source_context.Google.Protobuf.SourceContext.t option; mixins: Mixin.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
      let to_proto =
        let apply = fun ~f:f' { name; methods; options; version; source_context; mixins; syntax } -> f' [] name methods options version source_context mixins syntax in
        let spec = Runtime'.Serialize.C.( basic (1, string, proto3) ^:: repeated (2, (message (fun t -> Method.to_proto t)), not_packed) ^:: repeated (3, (message (fun t -> Imported'modules.Type.Google.Protobuf.Option.to_proto t)), not_packed) ^:: basic (4, string, proto3) ^:: basic_opt (5, (message (fun t -> Imported'modules.Source_context.Google.Protobuf.SourceContext.to_proto t))) ^:: repeated (6, (message (fun t -> Mixin.to_proto t)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.to_int), proto3) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize [] (spec) in
        fun t -> apply ~f:serialize t
      
      let from_proto =
        let constructor = fun _extensions name methods options version source_context mixins syntax -> { name; methods; options; version; source_context; mixins; syntax } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, proto3) ^:: repeated (2, (message (fun t -> Method.from_proto t)), not_packed) ^:: repeated (3, (message (fun t -> Imported'modules.Type.Google.Protobuf.Option.from_proto t)), not_packed) ^:: basic (4, string, proto3) ^:: basic_opt (5, (message (fun t -> Imported'modules.Source_context.Google.Protobuf.SourceContext.from_proto t))) ^:: repeated (6, (message (fun t -> Mixin.from_proto t)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int), proto3) ^:: nil ) in
        let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
        fun writer -> deserialize writer |> Runtime'.Result.open_error
      
    end
    and Method : sig
      val name': unit -> string
      type t = { name: string; request_type_url: string; request_streaming: bool; response_type_url: string; response_streaming: bool; options: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t } 
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
    end = struct 
      let name' () = "api.google.protobuf.Method"
      type t = { name: string; request_type_url: string; request_streaming: bool; response_type_url: string; response_streaming: bool; options: Imported'modules.Type.Google.Protobuf.Option.t list; syntax: Imported'modules.Type.Google.Protobuf.Syntax.t }
      let to_proto =
        let apply = fun ~f:f' { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax } -> f' [] name request_type_url request_streaming response_type_url response_streaming options syntax in
        let spec = Runtime'.Serialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: basic (3, bool, proto3) ^:: basic (4, string, proto3) ^:: basic (5, bool, proto3) ^:: repeated (6, (message (fun t -> Imported'modules.Type.Google.Protobuf.Option.to_proto t)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.to_int), proto3) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize [] (spec) in
        fun t -> apply ~f:serialize t
      
      let from_proto =
        let constructor = fun _extensions name request_type_url request_streaming response_type_url response_streaming options syntax -> { name; request_type_url; request_streaming; response_type_url; response_streaming; options; syntax } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: basic (3, bool, proto3) ^:: basic (4, string, proto3) ^:: basic (5, bool, proto3) ^:: repeated (6, (message (fun t -> Imported'modules.Type.Google.Protobuf.Option.from_proto t)), not_packed) ^:: basic (7, (enum Imported'modules.Type.Google.Protobuf.Syntax.from_int), proto3) ^:: nil ) in
        let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
        fun writer -> deserialize writer |> Runtime'.Result.open_error
      
    end
    and Mixin : sig
      val name': unit -> string
      type t = { name: string; root: string } 
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
    end = struct 
      let name' () = "api.google.protobuf.Mixin"
      type t = { name: string; root: string }
      let to_proto =
        let apply = fun ~f:f' { name; root } -> f' [] name root in
        let spec = Runtime'.Serialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize [] (spec) in
        fun t -> apply ~f:serialize t
      
      let from_proto =
        let constructor = fun _extensions name root -> { name; root } in
        let spec = Runtime'.Deserialize.C.( basic (1, string, proto3) ^:: basic (2, string, proto3) ^:: nil ) in
        let deserialize = Runtime'.Deserialize.deserialize [] spec constructor in
        fun writer -> deserialize writer |> Runtime'.Result.open_error
      
    end
  end
end
OCaml

Innovation. Community. Security.