pub struct EncoderParams { /* private fields */ }async_compression_unstable and crate feature brotli-mbrotli only.Expand description
Brotli compression parameters builder for the mbrotli backend. This is a stable wrapper
around mbrotli’s own encoder configuration, to abstract over different versions of the mbrotli
library.
The builder methods mirror brotli::params::EncoderParams where the two backends overlap, so
switching between them only needs a type change.
See the Brotli documentation for more information on these parameters.
§Examples
use compression_codecs::mbrotli;
let params = mbrotli::params::EncoderParams::default()
.window_size(12)
.text_mode();Implementations§
Source§impl EncoderParams
impl EncoderParams
pub fn quality(self, level: Level) -> EncoderParams
Sourcepub fn window_size(self, window_size: i32) -> EncoderParams
pub fn window_size(self, window_size: i32) -> EncoderParams
Sets window size in bytes (as a power of two).
Used as Brotli’s lgwin parameter.
window_size is clamped to 10 <= window_size <= 24, except 0 which selects the default
window, as the brotli backend does.
Sourcepub fn block_size(self, block_size: i32) -> EncoderParams
pub fn block_size(self, block_size: i32) -> EncoderParams
Sets input block size in bytes (as a power of two).
Used as Brotli’s lgblock parameter.
block_size is clamped to 16 <= block_size <= 24.
Sourcepub fn size_hint(self, size_hint: usize) -> EncoderParams
pub fn size_hint(self, size_hint: usize) -> EncoderParams
Sets hint for size of data to be compressed.
Sourcepub fn text_mode(self) -> EncoderParams
pub fn text_mode(self) -> EncoderParams
Sets encoder to text mode.
If input data is known to be UTF-8 text, this allows the compressor to make assumptions and optimizations.
Used as Brotli’s mode parameter.
Sourcepub fn font_mode(self) -> EncoderParams
pub fn font_mode(self) -> EncoderParams
Sets encoder to font mode.
Tunes the compressor for WOFF 2.0 font data.
Used as Brotli’s mode parameter.
Trait Implementations§
Source§impl Clone for EncoderParams
impl Clone for EncoderParams
Source§fn clone(&self) -> EncoderParams
fn clone(&self) -> EncoderParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more