Available on crate features
compression-brotli or compression-deflate or compression-gzip or compression-zstd or compression only.Expand description
Auto-compression module to compress responses body.
Structs§
- Compressable
Body - A wrapper around any type that implements
Streamto be compatible with async_compression’sStreambased encoders.
Functions§
- auto
- Create a wrapping handler that compresses the Body of a
hyper::Responseusing gzip,deflate,brotliorzstdif is specified in theAccept-Encodingheader, addingcontent-encoding: <coding>to the Response’sHeaderMap. It also provides the ability to apply compression for text-based MIME types only. - brotli
compression-brotliorcompression - Create a wrapping handler that compresses the Body of a
Response. using brotli, addingcontent-encoding: brto the Response’sHeaderMap. - create_
encoding_ header - Given an optional existing encoding header, appends to the existing or creates a new one.
- deflate
compression-deflateorcompression - Create a wrapping handler that compresses the Body of a
Response. using deflate, addingcontent-encoding: deflateto the Response’sHeaderMap. - get_
encodings - Get the
content-encodingsvia theaccept-encodingheader. - get_
preferred_ encoding - Try to get the preferred
content-encodingvia theaccept-encodingheader. - gzip
compression-gziporcompression - Create a wrapping handler that compresses the Body of a
Response. using gzip, addingcontent-encoding: gzipto the Response’sHeaderMap. - init
- Initializes dynamic compression.
- zstd
compression-zstdorcompression - Create a wrapping handler that compresses the Body of a
Response. using zstd, addingcontent-encoding: zstdto the Response’sHeaderMap.