package ocaml-protoc-plugin
Source file timestamp.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(************************************************) (* AUTOGENERATED FILE - DO NOT EDIT! *) (************************************************) (* Generated by: ocaml-protoc-plugin *) (* https://github.com/issuu/ocaml-protoc-plugin *) (************************************************) (* Source: google/protobuf/timestamp.proto Syntax: proto3 Parameters: annot='' debug=false opens=[] int64_as_int=true int32_as_int=true fixed_as_int=false singleton_record=false *) module Google = struct module Protobuf = struct module rec Timestamp : sig val name': unit -> string type t = { seconds: int; nanos: int } val to_proto: t -> Ocaml_protoc_plugin.Writer.t val from_proto: Ocaml_protoc_plugin.Reader.t -> t Ocaml_protoc_plugin.Result.t end = struct let name' () = "Timestamp.google.protobuf.Timestamp" type t = { seconds: int; nanos: int } let to_proto = let apply = fun ~f:f' { seconds; nanos } -> f' seconds nanos in let spec = Ocaml_protoc_plugin.Serialize.C.( basic (1, int64_int, proto3) ^:: basic (2, int32_int, proto3) ^:: nil ) in let serialize = Ocaml_protoc_plugin.Serialize.serialize (spec) in fun t -> apply ~f:(serialize ()) t let from_proto = let constructor = fun seconds nanos -> { seconds; nanos } in let spec = Ocaml_protoc_plugin.Deserialize.C.( basic (1, int64_int, proto3) ^:: basic (2, int32_int, proto3) ^:: nil ) in let deserialize = Ocaml_protoc_plugin.Deserialize.deserialize (spec) constructor in fun writer -> deserialize writer end end end