Library
Module
Module type
Parameter
Class
Class type
module Wire_type : sig ... end
Field types
val bool : bool field_type
Varint-encoded booleans
val int32 : int32 field_type
Varint-encoded signed 32-bit integers. This is space-inefficient for negative numbers; it is recommended to use sint32
instead if negative numbers are likely to be frequent.
val sint32 : int32 field_type
Zigzag-encoded signed 32-bit integer. This is more space-efficient for negative numbers than int32
.
val sfixed32 : int32 field_type
Fixed-size encoding of signed 32-bit integers.
val int64 : int64 field_type
Varint-encoded signed 64-bit integers. This is space-inefficient for negative numbers; it is recommended to use sint64
instead if negative numbers are likely to be frequent.
val sint64 : int64 field_type
Zigzag-encoded signed 64-bit integer. This is more space-efficient for negative numbers than int64
.
val sfixed64 : int64 field_type
Fixed-size encoding of signed 64-bit integers.
val uint32 : Unsigned.uint32 field_type
Varint-encoded unsigned 32-bit integers.
val fixed32 : Unsigned.uint32 field_type
Fixed-size encoding of unsigned 32-bit integers.
val uint64 : Unsigned.uint64 field_type
Varint-encoded unsigned 64-bit integers.
val fixed64 : Unsigned.uint64 field_type
Fixed-size encoding of unsigned 64-bit integers.
val double : float field_type
Fixed-size encoding of 64-bit floating-point numbers.
val float : float field_type
Fixed-size encoding of 32-bit floating-point numbers.
val string : string field_type
Length-delimited encoding of UTF-8 strings.
val bytes : Bytes.t field_type
Length-delimited encoding of byte strings.
val msg : 'm msgtype -> 'm msg field_type
Embedded message field type
val read_field : 'a field_type -> 'a Angstrom.t
read_field t
returns an Angstrom parser for a field descsribed by t
.
val write_field : 'a field_type -> Faraday.t -> 'a -> unit
write_field t f v
serializes the bytes of the encoding of v
described by t
, in order, to f
.
module type ENUM = sig ... end
val enum : string -> (module ENUM)
Create a new enum type
val constant_value : _ enum -> int32
The value of a constant
module type MESSAGE = sig ... end
val message : string -> (module MESSAGE)
Create a new message type
val pp_field_type : Format.formatter -> 'a field_type -> unit
Pretty-print a field type
Operations on values
val pp_field : 'a field_type -> Format.formatter -> 'a -> unit
Pretty-print a field value
val pp_msg : 'a msgtype -> Format.formatter -> 'a msg -> unit
Pretty-print a message
val read : 'm msgtype -> 'm msg Angstrom.t
read mt
returns an Angstrom parser for a message described by mt
.