Skip to main content

Crate trillium_compression

Crate trillium_compression 

Source
Expand description

Body compression for trillium.rs

Currently, this crate only supports compressing outbound bodies with the zstd, brotli, and gzip algorithms (in order of preference), although more algorithms may be added in the future. The correct algorithm will be selected based on the Accept-Encoding header sent by the client, if one exists.

Defaults are tuned for HTTP transport: brotli at quality 4 (matching nginx/caddy/Cloudflare). To opt into stronger or weaker compression, see Compression::with_brotli_level, Compression::with_gzip_level, and Compression::with_zstd_level.

Responses with Content-Encoding already set (e.g. precompressed sidecars) are passed through unchanged. Responses with already- compressed Content-Type (images, video, audio, fonts, archives) are skipped by default.

Structs§

Compression
Trillium handler for compression

Enums§

CompressionAlgorithm
Algorithms supported by this crate
Level
Level of compression data should be compressed with.

Functions§

compression
Alias for Compression::new