package ocaml-protoc

  1. Overview
  2. Docs
Pure OCaml compiler for .proto files

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-protoc-3.1.1.tbz
sha256=c5657fcbfcbaea361beb847f72b8a6a6f36ce9e773bf285b278a0da75f988fbc
sha512=ea86d04b6293eba48360409049f907fc3e73138ec434b5d1894a2dcdaa0478f6f5a1d13f1ba87c553ddf6806a618525f621d2af862b495ce3426242a3a42e339

doc/ocaml-protoc.compiler-lib/Ocaml_protoc_compiler_lib/Pb_codegen_util/index.html

Module Ocaml_protoc_compiler_lib.Pb_codegen_utilSource

Common utility functions for OCaml code generation

Sourceval sp : ('a, unit, string) format -> 'a

sp x same as sprintf but prefixed with new line

Sourceval let_decl_of_and : 'a option -> string

let_decl_of_and and_ returns the function declaration "let" (when ?and_ is None), "and" otherwise.

Sourceval string_of_record_field_type : ?module_prefix:string -> Pb_codegen_ocaml_type.record_field_type -> string
Sourceval string_of_basic_type : ?for_pp:bool -> Pb_codegen_ocaml_type.basic_type -> string
Sourceval string_of_field_type : ?for_pp:bool -> ?module_prefix:string -> Pb_codegen_ocaml_type.field_type -> string
Sourceval function_name_of_user_defined : function_prefix:string -> Pb_codegen_ocaml_type.user_defined_type -> string

function_name_of_user_defined prefix user_defined returns the function name of the form `(module'.'?)<prefix>_(type_name)`.

This pattern is common since a generated function for a type (encode/decode/to_string) will call the same generated function for each user defined field type.

Sourceval module_type_name_of_service_client : Pb_codegen_ocaml_type.service -> string

Name of the module type for this service (client)

Sourceval module_type_name_of_service_server : Pb_codegen_ocaml_type.service -> string

Name of the module type for this service (server)

Sourceval function_name_of_rpc : Pb_codegen_ocaml_type.rpc -> string

Name of the function for this RPC

Sourceval caml_file_name_of_proto_file_name : proto_file_name:string -> string

caml_file_name_of_proto_file_name filename returns the OCaml file name from the protobuf file name

Sourceval mutable_record_name : string -> string

mutable_record_name record_name returns the type name of the `mutable` type name. We use mutable types when decoding for better performance, this function encapsulate the nameing convention for this additional type.

Sourceval string_of_payload_kind : ?capitalize:unit -> Pb_codegen_ocaml_type.payload_kind -> bool -> string

string_of_payload_kind ~capitalize:() payload_kind packed will return the string corresponding to the payload kind.

Sourceval camel_case_of_label : string -> string

this function transforms a `lower_case_like_this` into an camlCaseLikeThis

Sourceval camel_case_of_constructor : string -> string

this function transform an OCaml constructuror `Like_this` into a 'likeThis' case

Sourceval collect_modules_of_types : Pb_codegen_ocaml_type.type_ list -> string list

collect_modules_of_types ocaml_types return the list of all the modules that the ocaml_types depends on

OCaml

Innovation. Community. Security.