De.Inf
The type for input sources. With a `Manual
source the client must provide input with src
. With `String
or `Channel
source the client can safely discard `Await
case (with assert false
).
decoder src ~o ~w
is a decoder that inputs from src
.
Output buffer.
de
uses o
buffer as internal buffer to store output. We recommend to allocate an io_buffer_size
buffer as output buffer. Then, dst_rem
gives you how many bytes it remains in o
.
Window.
de
needs a window to be able to interpret `Copy
code. Length of window is commonly 32k bytes (but the client can use a smaller one with some assumptions).
decode d
is:
`Await
if d
has a `Manual
input source and awaits for more input. The client must use src
to provide it.`Flush d
if given output buffer o
(see decoder
) is full. The client must use flush
to completely flush o
. dst_rem
gives you how many bytes it remains in o
. Inf.dst_rem d - bigstring_length o
gives you how many bytes are available.`Malformed err
if given input is malformed. err
is a human-readable error.`End
if given input notify end of flow. o
is possibly not empty (it can be check with dst_rem
).src d s j l
provides d
with l
bytes to read, starting at j
in s
. This byte range is read by calls to decode
with d
until `Await
is returned. To signal the end of input call the function with l = 0
.
val dst_rem : decoder -> int
dst_rem d
is how many bytes it remains in given output buffer o
.
val src_rem : decoder -> int
src_rem d
is how many bytes it remains in given input buffer.
val flush : decoder -> unit
flush d
provides d
with new output storage.