package ocaml-protoc

  1. Overview
  2. Docs

Types

type t

Error

type error =
  1. | Overflow of string
val error_to_string : error -> string
exception Failure of error

Creator

val create : unit -> t

Convertion

val to_bytes : t -> bytes
val to_string : t -> string

Encoding Functions

val key : (int * payload_kind) -> t -> unit

key (k, pk) e writes a key and a payload kind to e.

val nested : (t -> unit) -> t -> unit

nested f e applies f to an encoder for a message nested in e.

val map_entry : encode_key:('a -> t -> unit) -> encode_value:('b -> t -> unit) -> (('a * payload_kind) * ('b * payload_kind)) -> t -> unit
val empty_nested : t -> unit

nested f e encodes a zero length empty message

val int_as_varint : int -> t -> unit

int_as_varint i e encodes i in e with Varint encoding

val int_as_zigzag : int -> t -> unit

int_as_zigzag i e encodes i in e with Varint zigzag encoding

val int32_as_varint : int32 -> t -> unit

int32_as_varint i e encodes i in e with Varint encoding

val int32_as_zigzag : int32 -> t -> unit

int32_as_varint i e encodes i in e with Varint zigzag encoding

val int64_as_varint : int64 -> t -> unit

int64_as_varint i e encodes i in e with Varint encoding

val int64_as_zigzag : int64 -> t -> unit

int64_as_varint i e encodes i in e with Varint zigzag encoding

val int32_as_bits32 : int32 -> t -> unit

int32_as_varint i e encodes i in e with Bits32 encoding

val int64_as_bits64 : int64 -> t -> unit

int64_as_varint i e encodes i in e with Bits64 encoding

val bool : bool -> t -> unit

encode b e encodes b in e with Varint encoding

val float_as_bits32 : float -> t -> unit

float_as_bits32 f e encodes f in e with Bits32 encoding

val float_as_bits64 : float -> t -> unit

float_as_bits64 f e encodes f in e with Bits64 encoding

val int_as_bits32 : int -> t -> unit

int_as_bits32 i e encodes i in e with Bits32 encoding TODO : add error handling

val int_as_bits64 : int -> t -> unit

int_as_bits64 i e encodes i in e with Bits64 encoding

val string : string -> t -> unit

string s e encodes s in e

val bytes : bytes -> t -> unit

string s e encodes s in e

val wrapper_double_value : float option -> t -> unit
val wrapper_float_value : float option -> t -> unit
val wrapper_int64_value : int64 option -> t -> unit
val wrapper_int32_value : int32 option -> t -> unit
val wrapper_bool_value : bool option -> t -> unit
val wrapper_string_value : string option -> t -> unit
val wrapper_bytes_value : bytes option -> t -> unit
OCaml

Innovation. Community. Security.