package decompress
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ea6987f72816044ccf3edb586e3b64668d53c5ef1b0a735119e5c9d740504240
md5=547eaf0803af3ed01ff7801facfe27e6
doc/decompress.rfc1951/Rfc1951/module-type-INFLATE/index.html
Module type Rfc1951.INFLATE
Source
Inflate algorithm.
A functionnal non-blocking implementation of Zlib algorithm.
Inflate error.
Pretty-printer of inflate error.
Pretty-printer of inflate state.
val eval :
'a B.t ->
'a B.t ->
('a, 'a) t ->
[ `Await of ('a, 'a) t
| `Flush of ('a, 'a) t
| `End of ('a, 'a) t
| `Error of ('a, 'a) t * error ]
eval i o t
computes the state t
with the input i
and the output o
. This function returns:
`Await t
: the statet
waits a new input, may be you userefill
.`Flush t
: the statet
completes the output, may be you useflush
.`End t
: means that the deflate algorithm is done in your input. May bet
writes something in your output. You can check withused_out
.`Error (t, exn)
: the algorithm catches an errorexn
.
refill off len t
allows the state t
to use an output at off
on len
byte(s).
flush off len t
allows the state t
to use an output at off
on len
byte(s).
used_out ŧ
returns how many byte(s) was used by t
in the output.
val to_result :
'a B.t ->
'a B.t ->
('a B.t -> int) ->
('a B.t -> int -> int) ->
('a, 'a) t ->
(('a, 'a) t, error) result
to_result i o refill flush t
is a convenience function to apply the inflate algorithm on the stream refill
and call flush
when the internal output is full (and need to flush).
If the compute catch an error, we returns Error exn
(see INFLATE.error
). Otherwise, we returns the state useless t
.
val bytes :
Bytes.t ->
Bytes.t ->
(Bytes.t -> int) ->
(Bytes.t -> int -> int) ->
(B.st, B.st) t ->
((B.st, B.st) t, error) result
Specialization of to_result
with B.Bytes.t
.
val bigstring :
B.Bigstring.t ->
B.Bigstring.t ->
(B.Bigstring.t -> int) ->
(B.Bigstring.t -> int -> int) ->
(B.bs, B.bs) t ->
((B.bs, B.bs) t, error) result
Specialization of to_result
with B.Bigstring.t
.