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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! Pure Rust, high performance implementation of LZ4 compression.
//!
//! A detailed explanation of the algorithm can be found [here](http://ticki.github.io/blog/how-lz4-works/).
//!
//! # Overview
//!
//! This crate provides two ways to use lz4. The first way is through the
//! [`frame::FrameDecoder`](frame/struct.FrameDecoder.html)
//! and
//! [`frame::FrameEncoder`](frame/struct.FrameEncoder.html)
//! types, which implement the `std::io::Read` and `std::io::Write` traits with the
//! lz4 frame format. Unless you have a specific reason to the contrary, you
//! should only use the lz4 frame format. Specifically, the lz4 frame format
//! permits streaming compression or decompression.
//!
//! The second way is through the
//! [`decompress_size_prepended`](block/fn.decompress_size_prepended.html)
//! and
//! [`compress_prepend_size`](block/fn.compress_prepend_size.html)
//! functions. These functions provide access to the lz4 block format, and
//! don't support a streaming interface directly. You should only use these types
//! if you know you specifically need the lz4 block format.
//!
//! # Example: compress data on `stdin` with frame format
//! This program reads data from `stdin`, compresses it and emits it to `stdout`.
//! This example can be found in `examples/compress.rs`:
//! ```no_run
//! use std::io;
//! let stdin = io::stdin();
//! let stdout = io::stdout();
//! let mut rdr = stdin.lock();
//! // Wrap the stdout writer in a LZ4 Frame writer.
//! let mut wtr = lz4_flex::frame::FrameEncoder::new(stdout.lock());
//! io::copy(&mut rdr, &mut wtr).expect("I/O operation failed");
//! wtr.finish().unwrap();
//! ```
//! # Example: decompress data on `stdin` with frame format
//! This program reads data from `stdin`, decompresses it and emits it to `stdout`.
//! This example can be found in `examples/decompress.rs`:
//! ```no_run
//! use std::io;
//! let stdin = io::stdin();
//! let stdout = io::stdout();
//! // Wrap the stdin reader in a LZ4 FrameDecoder.
//! let mut rdr = lz4_flex::frame::FrameDecoder::new(stdin.lock());
//! let mut wtr = stdout.lock();
//! io::copy(&mut rdr, &mut wtr).expect("I/O operation failed");
//! ```
//!
//! # Example: block format roundtrip
//! ```
//! use lz4_flex::block::{compress_prepend_size, decompress_size_prepended};
//! let input: &[u8] = b"Hello people, what's up?";
//! let compressed = compress_prepend_size(input);
//! let uncompressed = decompress_size_prepended(&compressed).unwrap();
//! assert_eq!(input, uncompressed);
//! ```
//!
//! ## Feature Flags
//!
//! - `safe-encode` uses only safe rust for encode. _enabled by default_
//! - `safe-decode` uses only safe rust for encode. _enabled by default_
//! - `frame` support for LZ4 frame format. _implies `std`, enabled by default_
//! - `std` enables dependency on the standard library. _implies `alloc`, enabled by default_
//! - `alloc` enables APIs that allocate, e.g. [`compress`](block/fn.compress.html) returning a
//! `Vec`. _enabled by default_
//!
//! For maximum performance use `no-default-features`.
//!
//! For no_std support only the [`block format`](block/index.html) is supported.
//!
//! Without the `alloc` feature only the `_into` variants are available, e.g.
//! [`compress_into`](block/fn.compress_into.html). Compression then places its hash table
//! (8-16KB) on the stack. Alternatively
//! [`compress_into_with_table`](block/fn.compress_into_with_table.html) can be used with a
//! statically allocated [`CompressTable`](block/enum.CompressTable.html).
//!
//!
extern crate alloc;
extern crate more_asserts;
pub use compress_into;
pub use decompress_into;
pub use ;
pub use ;
pub