1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Allocation-free streaming zlib encoding and inflation (RFC 1950/1951).
//! The encoder uses stored blocks; the decoder also accepts fixed and dynamic
//! Huffman blocks, with caller-owned history and explicit expansion budgets.
//! The decoder is implemented from [RFC 1950](https://www.rfc-editor.org/rfc/rfc1950)
//! and [RFC 1951](https://www.rfc-editor.org/rfc/rfc1951).
//!
//! ```
//! # #[cfg(feature = "read")] {
//! use git_zero_core::{io::{SliceWriter, Write}, zlib::{Inflater, InflateLimits, InflateStatus, WINDOW_SIZE}};
//! # fn example() -> git_zero_core::Result<()> {
//! let mut input: &[u8] = &[120, 156, 203, 72, 205, 201, 201, 7, 0, 6, 44, 2, 21];
//! let mut window = [0; WINDOW_SIZE];
//! let limits = InflateLimits { max_output: 5, max_ratio: 16, ratio_slack: 0 };
//! let mut decoder = Inflater::new(&mut window, limits);
//! let mut scratch = [0; 2];
//! let mut storage = [0; 5];
//! let mut staged = SliceWriter::new(&mut storage);
//! loop {
//! let progress = decoder.update(input, &mut scratch, true)?;
//! staged.write_all(&scratch[..progress.written])?;
//! input = &input[progress.consumed..];
//! if progress.status == InflateStatus::Finished { break; }
//! }
//! assert_eq!(staged.as_bytes(), b"hello");
//! assert!(input.is_empty());
//! # Ok(()) }
//! # example().unwrap();
//! # }
//! ```
pub
/// zlib compressBound for its default window/memory settings (as used by Git).
/// Includes wrapper/checksum overhead, with checked arithmetic. This is not a
/// bound on arbitrarily padded streams or other deflate settings.
/// https://github.com/madler/zlib/blob/master/compress.c
pub use ;
pub use decode_gzip;
pub use write_parts;
pub use write_reader;
pub use StoredEncoder;