Available on crate feature compression only.
Expand description

Auto-compression module to compress responses body.

Structs

  • A wrapper around any type that implements Stream to be compatible with async_compression’s Stream based encoders.

Constants

  • Contains a fixed list of common text-based MIME types in order to apply compression.

Functions

  • Create a wrapping handler that compresses the Body of a Response using gzip, deflate, brotli or zstd if is specified in the Accept-Encoding header, adding content-encoding: <coding> to the Response’s HeaderMap It also provides the ability to apply compression for text-based MIME types only.
  • brotlicompression-brotli
    Create a wrapping handler that compresses the Body of a Response using brotli, adding content-encoding: br to the Response’s HeaderMap
  • Given an optional existing encoding header, appends to the existing or creates a new one.
  • deflatecompression-deflate
    Create a wrapping handler that compresses the Body of a Response using deflate, adding content-encoding: deflate to the Response’s HeaderMap
  • Try to get the prefered content-encoding via the accept-encoding header.
  • gzipcompression-gzip
    Create a wrapping handler that compresses the Body of a Response using gzip, adding content-encoding: gzip to the Response’s HeaderMap
  • zstdcompression-zstd
    Create a wrapping handler that compresses the Body of a Response using zstd, adding content-encoding: zstd to the Response’s HeaderMap