package pb

  1. Overview
  2. Docs
Library for describing Protobuf messages

Install

Dune Dependency

Authors

Maintainers

Sources

pb-1.0.0.tbz
sha256=e670f11879ee5e44de396fda26ce18384093fd9d75b33727fe90db073e1e4d01
sha512=d6d5bd2991af3bb0121c6f9620510707e5b25332ff80224a1da482093ed53427b620e01294be4d52637dfedad8c30775ad228ac74a6d579d7c3a1de5887327cc

doc/pb/Pb/index.html

Module PbSource

Sourcemodule Wire_type : sig ... end

Field types

Sourcetype 'a field_type

The type of protobuf field encodings.

Sourceval bool : bool field_type

Varint-encoded booleans

Sourceval 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.

Sourceval sint32 : int32 field_type

Zigzag-encoded signed 32-bit integer. This is more space-efficient for negative numbers than int32.

Sourceval sfixed32 : int32 field_type

Fixed-size encoding of signed 32-bit integers.

Sourceval 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.

Sourceval sint64 : int64 field_type

Zigzag-encoded signed 64-bit integer. This is more space-efficient for negative numbers than int64.

Sourceval sfixed64 : int64 field_type

Fixed-size encoding of signed 64-bit integers.

Varint-encoded unsigned 32-bit integers.

Fixed-size encoding of unsigned 32-bit integers.

Varint-encoded unsigned 64-bit integers.

Fixed-size encoding of unsigned 64-bit integers.

Sourceval double : float field_type

Fixed-size encoding of 64-bit floating-point numbers.

Sourceval float : float field_type

Fixed-size encoding of 32-bit floating-point numbers.

Sourceval string : string field_type

Length-delimited encoding of UTF-8 strings.

Length-delimited encoding of byte strings.

Sourcetype _ msg

A value of type msg represents a message

Sourcetype _ msgtype

A value of type msgtype represents a message type

Sourceval msg : 'm msgtype -> 'm msg field_type

Embedded message field type

Sourceval read_field : 'a field_type -> 'a Angstrom.t

read_field t returns an Angstrom parser for a field descsribed by t.

Sourceval 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.

Sourcetype _ enum
Sourcemodule type ENUM = sig ... end
Sourceval enum : string -> (module ENUM)

Create a new enum type

Sourceval constant_value : _ enum -> int32

The value of a constant

Sourcetype (_, _) field

A value of type (m, t) field describes a field of type t in a message of type m.

Sourcemodule type MESSAGE = sig ... end
Sourceval message : string -> (module MESSAGE)

Create a new message type

Sourceval pp_field_type : Format.formatter -> 'a field_type -> unit

Pretty-print a field type

Operations on values

Sourceval getf : 'm msg -> ('m, 'a) field -> 'a

Read a field of a message

Sourceval setf : 'm msg -> ('m, 'a) field -> 'a -> unit

Write a field of a message

Sourceval pp_field : 'a field_type -> Format.formatter -> 'a -> unit

Pretty-print a field value

Sourceval pp_msg : 'a msgtype -> Format.formatter -> 'a msg -> unit

Pretty-print a message

Sourceval create : 'm msgtype -> 'm msg

create mt creates a message of the type represented by mt.

Sourceval read : 'm msgtype -> 'm msg Angstrom.t

read mt returns an Angstrom parser for a message described by mt.

Sourceval write : _ msg -> Faraday.t

write m builds a Faraday serializer for m.

Sourceexception Parse_error
OCaml

Innovation. Community. Security.

On This Page