package ppx_deriving_protobuf
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=5287ef0db8d4f7a62b0bb7a21010172d602aa45a7fecc2d4cb9681366ddf81b5
sha512=6bc04d10c2448a35c9c2404be01aab616d51cdda563f6f3b8d213db18614233746c6bf2190a3f12881f544e91c18aa01d56f9aeeb7b01eddfe68123b88703625
doc/ppx_deriving_protobuf.runtime/Protobuf/Decoder/index.html
Module Protobuf.Decoder
Source
type error =
| Incomplete
| Overlong_varint
| Malformed_field
| Overflow of string
| Unexpected_payload of string * payload_kind
| Missing_field of string
| Malformed_variant of string
Type of failures possible while decoding.
error_to_string e
converts error e
to its string representation.
Type of wire format decoders.
at_end d
returns true
if d
has exhausted its input, and false
otherwise.
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
.
varint d
reads a varint from d
. If d
has exhausted its input, raises Failure Incomplete
.
zigzag d
reads a varint from d
and zigzag-decodes it. If d
has exhausted its input, raises Failure Incomplete
.
bits32 d
reads four bytes from d
. If d
has exhausted its input, raises Failure Incomplete
.
bits64 d
reads eight bytes from d
. If d
has exhausted its input, raises Failure Incomplete
.
bytes d
reads a varint indicating length and then that much bytes from d
. If d
has exhausted its input, raises Failure Incomplete
.
nested d
returns a decoder for a message nested in d
. If reading the message would exhaust input of d
, raises Failure Incomplete
.
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
.
decode f b
≡ try Some (decode_exn f b) with Failure _ -> None
int_of_int32 fld v
returns v
truncated to int
. If the value doesn't fit in the range of int
, raises Failure (Overflow fld)
.
int_of_int64 fld v
returns v
truncated to int
. If the value doesn't fit in the range of int
, raises Failure (Overflow fld)
.
int32_of_int64 fld v
returns v
truncated to int32
. If the value doesn't fit in the range of int32
, raises Failure (Overflow fld)
.
bool_of_int64 fld v
returns v
truncated to bool
. If the value doesn't fit in the range of bool
, raises Failure (Overflow fld)
.