package ocaml-protoc-plugin

  1. Overview
  2. Docs
Plugin for protoc protobuf compiler to generate ocaml definitions from a .proto file

Install

Dune Dependency

Authors

Maintainers

Sources

4.4.0.tar.gz
md5=33eec898e6b8b31ec1f8aed351a32b5d
sha512=3f7515c430bad3706dbe2fcfdbe0d5b33984dd6300adfc3cbbe912f033c3868eaa65d916eabac91195506f02f151cabb4f8173b732b020673ac7df04f9e48172

doc/src/ocaml-protoc-plugin.google_types/field_mask.ml.html

Source file field_mask.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
(************************************************)
(*       AUTOGENERATED FILE - DO NOT EDIT!      *)
(************************************************)
(* Generated by: ocaml-protoc-plugin            *)
(* https://github.com/issuu/ocaml-protoc-plugin *)
(************************************************)
(*
  Source: google/protobuf/field_mask.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 Google = struct
  module Protobuf = struct
    module rec FieldMask : sig
      val name': unit -> string
      type t = string list 
      val make : ?paths:string list -> unit -> t
      val to_proto: t -> Runtime'.Writer.t
      val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result
    end = struct 
      let name' () = "field_mask.google.protobuf.FieldMask"
      type t = string list
      let make =
        fun ?paths () -> 
        let paths = match paths with Some v -> v | None -> [] in
        paths
      
      let to_proto =
        let apply = fun ~f:f' paths -> f' [] paths in
        let spec = Runtime'.Serialize.C.( repeated (1, string, packed) ^:: nil ) in
        let serialize = Runtime'.Serialize.serialize [] (spec) in
        fun t -> apply ~f:serialize t
      
      let from_proto =
        let constructor = fun _extensions paths -> paths in
        let spec = Runtime'.Deserialize.C.( repeated (1, string, packed) ^:: 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.