Skip to main content

http_compress/
lib.rs

1//! http-compress
2//!
3//! A high-performance async library for HTTP compression/decompression,
4//! supporting Brotli, Deflate, and Gzip algorithms. Provides both compression
5//! and decompression capabilities with optimized memory usage,
6//! ideal for HTTP clients/servers and network programming.
7
8mod brotli;
9mod compress;
10mod deflate;
11mod gzip;
12mod xx_hash3_64;
13
14#[cfg(test)]
15#[path = "../tests/mod.rs"]
16mod tests;
17
18pub use {compress::Compress, xx_hash3_64::*};
19
20pub(crate) use compress::{
21    BROTLI_DEFAULT_QUALITY, BROTLI_DEFAULT_WINDOW_BITS, MAX_DECOMPRESSED_BYTES,
22};
23
24use std::{
25    borrow::Cow,
26    cell::RefCell,
27    collections::HashMap,
28    fmt,
29    mem::{MaybeUninit, size_of},
30    ptr, slice,
31    str::FromStr,
32    thread_local,
33};
34
35use {
36    ::brotli::{
37        Allocator, BrotliDecompressStream, BrotliResult, BrotliState, HuffmanCode, SliceWrapper,
38        SliceWrapperMut,
39        enc::{
40            BrotliAlloc, PDF, StaticCommand, ZopfliNode,
41            cluster::HistogramPair,
42            command::Command,
43            encode::{
44                BrotliEncoderDestroyInstance, BrotliEncoderOperation, BrotliEncoderParameter,
45                BrotliEncoderStateStruct,
46            },
47            entropy_encode::HuffmanTree,
48            floatX,
49            histogram::{ContextType, HistogramCommand, HistogramDistance, HistogramLiteral},
50            interface::PredictionModeContextMap,
51            s16, v8,
52        },
53        {InputPair, InputReferenceMut},
54    },
55    core::hash::{BuildHasherDefault, Hasher},
56    flate2::{self, Compression, Crc, Decompress, FlushCompress, FlushDecompress, Status},
57    twox_hash::xxhash3_64::{self, DEFAULT_SECRET_LENGTH, RawHasher, SecretBuffer},
58};