A buffer for incremental decoding of an input stream.
An Unpack_buffer.t is a buffer to which one can feed strings, and then unpack
from the buffer to produce a queue of values.
module Unpack_one : sig ... endinclude sig ... endval sexp_of_t : ('a ‑> Base.Sexp.t) ‑> 'a t ‑> Base.Sexp.tinclude Core_kernel__.Import.Invariant.S1 with type a t := a tval invariant : 'a Base__.Invariant_intf.inv ‑> 'a t Base__.Invariant_intf.invval create : 'a Unpack_one.t ‑> 'a tval create_unpacked : ?partial_unpack:'partial_unpack ‑> ('a, 'partial_unpack) Unpack_one.unpacked ‑> 'a tval create_bin_prot : 'a Bin_prot.Type_class.reader ‑> 'a tcreate_bin_prot reader returns an unpack buffer that unpacks 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 bin_prot data itself.
val is_empty : _ t ‑> Core_kernel__.Import.bool Or_error.tis_empty t returns true if t has no unconsumed bytes, and false if it does.
is_empty returns an error if t has encountered an unpacking error.
val feed : ?pos:Core_kernel__.Import.int ‑> ?len:Core_kernel__.Import.int ‑> _ t ‑> Bigstring.t ‑> Core_kernel__.Import.unit Or_error.tfeed t buf ?pos ?len adds the specified substring of buf to t's buffer. It
returns an error if t has encountered an unpacking error.
val feed_string : ?pos:Core_kernel__.Import.int ‑> ?len:Core_kernel__.Import.int ‑> _ t ‑> Core_kernel__.Import.string ‑> Core_kernel__.Import.unit Or_error.tval feed_bytes : ?pos:Core_kernel__.Import.int ‑> ?len:Core_kernel__.Import.int ‑> _ t ‑> Bytes.t ‑> Core_kernel__.Import.unit Or_error.tval unpack_into : 'a t ‑> 'a Queue.t ‑> Core_kernel__.Import.unit Or_error.tunpack_into t q unpacks all the values that it can from t and enqueues them in
q. If there is an unpacking error, unpack_into returns an error, and subsequent
feed and unpack operations on t will return that same error -- i.e. no more data
can be fed to or unpacked from t.
val unpack_iter : 'a t ‑> f:('a ‑> Core_kernel__.Import.unit) ‑> Core_kernel__.Import.unit Or_error.tunpack_iter t ~f unpacks all the values that it can from t, calling f on each
value as it's unpacked. If there is an unpacking error (including if f raises),
unpack_iter returns an error, and subsequent feed and unpack operations on t
will return that same error -- i.e., no more data can be fed to or unpacked from t.
Behavior is unspecified if f operates on t.