Module Unpack_buffer.Unpack_one

module Unpack_one: sig .. end


If unpack_one : ('value, 'partial_unpack) unpack_one, then unpack_one buf ?pos ?len ?partial_unpack must unpack at most one value of type 'value from buf starting at pos, and not using more than len characters. unpack_one must returns one the following:

A naive unpack_one that only succeeds on a fully packed value could lead to quadratic behavior if a packed value's bytes are input using a linear number of calls to feed.
type ('value, 'partial_unpack) t = ?partial_unpack:'partial_unpack ->
?pos:int ->
?len:int ->
Bigstring.t ->
[ `Invalid_data of Error.t
| `Not_enough_data of 'partial_unpack * int
| `Ok of 'value * int ]
val map : ('a, 'partial_unpack) t ->
f:('a -> 'b) -> ('b, 'partial_unpack) t
val create_bin_prot : 'a Bin_prot.Type_class.reader -> ('a, unit) t
create_bin_prot reader returns an unpacker that reads the "size-prefixed" bin_prot encoding, in which a value is encoded by first writing the length of the bin_prot data as a 64-bit int, and then writing the data itself. This encoding makes it trivial to know if enough data is available in the buffer, so there is no need to represent partially unpacked values, and hence 'partial_unpack = unit.
type partial_sexp 
Beware that when unpacking sexps, one cannot tell if one is at the end of an atom until one hits punctuation. So, one should always feed a space (" ") to a sexp unpack buffer after feeding a batch of complete sexps, to ensure that the final sexp is unpacked.
val sexp : (Sexp.t, partial_sexp)
t