Up

Module Unpack_sequence = Async_extra.Unpack_sequence

Signature

module Unpack_iter_result : sig .. end
module Unpack_result : sig .. end
module Unpack_from : sig .. end
Unpack_from specifies the source of the sequence of bytes to unpack from.

unpack_into_pipe ~from:input ~using:unpack_buffer returns (output, result), and uses unpack_buffer to unpack values from input until input is closed. It puts the unpacked values into output, which is closed once unpacking finishes, be it normally or due to an error. result indicates why unpacking finished.

To unpack from a bin_reader, use:


      unpack_into_pipe ~from ~using:(Unpack_buffer.create_bin_prot bin_reader)
    

Using ~from:(Reader reader) is more efficient than ~from:(Pipe (Reader.pipe reader)) because it blits bytes directly from the reader buffer to the unpack buffer, without any intervening allocation.

val unpack_iter : from:Unpack_from.t -> using:'a Core.Std.Unpack_buffer.t -> f:('a -> unit) -> 'a Unpack_iter_result.t Async_extra.Import.Deferred.t