ocaml-protoc-plugin.protobuf
Protobuf.Reader
Some buffer to hold data, and to read and write data
type t = {
mutable offset : int;
end_offset : int;
data : StdLabels.String.t;
}
type error = [
| `Premature_end_of_input
| `Unknown_field_type of int
]
val create : ?offset:int -> ?length:int -> StdLabels.String.t -> t
val size : t -> int
val validate_capacity : t -> int -> (unit, [> `Premature_end_of_input ]) result
Return an error if there is not enough data in input
val has_more : t -> bool
Test if there is more data in the buffer to be read
val read_byte : t -> (int, [> `Premature_end_of_input ]) result
val read_raw_varint : t -> (int64, [> `Premature_end_of_input ]) result
val read_varint : t -> (Protobuf__.Field.t, [> `Premature_end_of_input ]) result
val read_field_header : t -> (int * int) Result.t
val read_length_delimited : t -> (Protobuf__.Field.t, [> `Premature_end_of_input ]) result
val read_fixed32 : t -> (Protobuf__.Field.t, [> `Premature_end_of_input ]) result
val read_fixed64 : t -> (Protobuf__.Field.t, [> `Premature_end_of_input ]) result
val read_field : t -> (int * Protobuf__.Field.t) Result.t