package ocaml-protoc

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Pbrt.DecoderSource

Types

Sourcetype t

Creator

Sourceval of_bytes : bytes -> t

of_bytes b creates a decoder positioned at start of bytes b.

Sourceval of_string : string -> t

of_string s creates a decoder positioned at start of string s.

Errors

Sourcetype error =
  1. | Incomplete
  2. | Overlong_varint
  3. | Malformed_field
  4. | Overflow of string
  5. | Unexpected_payload of string * payload_kind
  6. | Missing_field of string
  7. | Malformed_variant of string
Sourceval error_to_string : error -> string

error_to_string e converts error e to its string representation.

Sourceexception Failure of error
Sourceval malformed_variant : string -> 'a

malformed_variant variant_name raises the exception Protobuf.Decoder.Failure (Malformed_variant variant_name)

Sourceval unexpected_payload : string -> payload_kind -> 'a

unexpected_payload field_name pk raises the exception Protobuf.Decoder.Failure (Unexpected_payload (field_name, pk))

Sourceval missing_field : string -> 'a

missing_field field_name raises the exception Protobuf.Decoder.Failure (Missing_field field_name)

Decoding Functions

Sourceval key : t -> (int * payload_kind) option

key d reads a key and a payload kind from d. If d has exhausted its input when the function is called, returns None. If d has exhausted its input while reading, raises Failure Incomplete. If the payload kind is unknown, raises Failure Malformed_field.

Sourceval skip : t -> payload_kind -> unit

skip d pk skips the next value of kind pk in d. If skipping the value would exhaust input of d, raises Encoding_error Incomplete.

Sourceval nested : t -> t

nested d returns a decoder for a message nested in d. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval map_entry : t -> decode_key:(t -> 'a) -> decode_value:(t -> 'b) -> 'a * 'b
Sourceval empty_nested : t -> unit

empty_nested d skips an empty message of 0 length. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval packed_fold : ('a -> t -> 'a) -> 'a -> t -> 'a

packed_fold f e0 d folds over the a packed encoding with f acc d and initial value e0. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int_as_varint : t -> int

int_as_varint d reads an int value from d with Varint encoding. If the integer value read cannot be converted to int raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int_as_zigzag : t -> int

int_as_zigzag d reads an int value from d with zigzag encoding. If the integer value read cannot be converted to int raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int32_as_varint : t -> int32

int32_as_varint d reads an int32 value from d with Varint encoding. If the integer value read cannot be converted to int32 raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int32_as_zigzag : t -> int32

int32_as_varint d reads an int32 value from d with zigzag encoding. If the integer value read cannot be converted to int32 raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int64_as_varint : t -> int64

int64_as_varint d reads an int64 value from d with Varint encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int64_as_zigzag : t -> int64

int64_as_varint d reads an int64 value from d with zigzag encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int32_as_bits32 : t -> int32

int32_as_bits32 d reads an int32 value from d with 32 bit encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int64_as_bits64 : t -> int64

int64_as_bits64 d reads an int64 value from d with 64 bit encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval bool : t -> bool

bool d reads a bool value from d with varing encoding. If the boolean value in d is neither 0 or 1 raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval float_as_bits32 : t -> float

float_as_bits32 d reads a float value from d with 32 bit encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval float_as_bits64 : t -> float

float_as_bits64 d reads a float value from d with 64 bit encoding. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int_as_bits32 : t -> int

int_as_bits32 d reads a int value from d with 32 bit encoding. If the integer value read cannot be converted to int raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval int_as_bits64 : t -> int

int_as_bits64 d reads a int value from d with 64 bit encoding. If the integer value read cannot be converted to int raises Failure Overflow "". If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval string : t -> string

string d reads a string value from d. If reading the message would exhaust input of d, raises Failure Incomplete.

Sourceval bytes : t -> bytes

bytes d reads a bytes value from d. If reading the message would exhaust input of d, raises Failure Incomplete.

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

Innovation. Community. Security.