Module Unpack_buffer
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 ... endval sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
include Unpack_buffer__.Import.Invariant.S1 with type 'a t := 'a t
val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val create : 'a Unpack_one.t -> 'a tval create_bin_prot : 'a Bin_prot.Type_class.reader -> 'a tcreate_bin_prot readerreturns 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 -> bool Unpack_buffer__.Import.Or_error.tis_emptyreturnstrueif all the data fed intothas been unpacked into values;falseifthas unconsumed bytes or partially unpacked data.is_emptyreturns an error ifthas encountered an unpacking error.
val feed : ?pos:int -> ?len:int -> _ t -> Unpack_buffer__.Import.Bigstring.t -> unit Unpack_buffer__.Import.Or_error.tfeed t buf ?pos ?lenadds the specified substring ofbuftot's buffer. It returns an error ifthas encountered an unpacking error.
val feed_string : ?pos:int -> ?len:int -> _ t -> string -> unit Unpack_buffer__.Import.Or_error.tval feed_bytes : ?pos:int -> ?len:int -> _ t -> Unpack_buffer__.Import.Bytes.t -> unit Unpack_buffer__.Import.Or_error.tval unpack_into : 'a t -> 'a Unpack_buffer__.Import.Queue.t -> unit Unpack_buffer__.Import.Or_error.tunpack_into t qunpacks all the values that it can fromtand enqueues them inq. If there is an unpacking error,unpack_intoreturns an error, and subsequentfeedand unpack operations ontwill return that same error -- i.e. no more data can be fed to or unpacked fromt.
val unpack_iter : 'a t -> f:('a -> unit) -> unit Unpack_buffer__.Import.Or_error.tunpack_iter t ~funpacks all the values that it can fromt, callingfon each value as it's unpacked. If there is an unpacking error (including iffraises),unpack_iterreturns an error, and subsequentfeedand unpack operations ontwill return that same error -- i.e., no more data can be fed to or unpacked fromt.Behavior is unspecified if
foperates ont.
val debug : bool Unpack_buffer__.Import.refdebugcontrols whether invariants are checked at each call. Setting this totruecan make things very slow.