pub struct CompressionConfig {
pub algorithm: CompressionAlgorithm,
pub level: u32,
pub min_size: usize,
pub compressible_types: Vec<String>,
pub compress_encoded: bool,
}Expand description
Configuration for the compression middleware
Fields§
§algorithm: CompressionAlgorithmThe compression algorithm to use
level: u32Compression level (algorithm-specific range)
min_size: usizeMinimum response size in bytes to compress (default: 860 bytes) Responses smaller than this won’t be compressed
compressible_types: Vec<String>Content types to compress (default: text/*, application/json, etc.)
compress_encoded: boolWhether to compress responses that already have Content-Encoding
Implementations§
Source§impl CompressionConfig
impl CompressionConfig
Sourcepub fn builder() -> CompressionConfigBuilder
pub fn builder() -> CompressionConfigBuilder
Create a builder for configuration
Sourcepub fn effective_level(&self) -> u32
pub fn effective_level(&self) -> u32
Get the effective compression level for the configured algorithm
Sourcepub fn should_compress_content_type(&self, content_type: &str) -> bool
pub fn should_compress_content_type(&self, content_type: &str) -> bool
Check if a content type should be compressed
Sourcepub fn should_compress_size(&self, size: usize) -> bool
pub fn should_compress_size(&self, size: usize) -> bool
Check if a response should be compressed based on size
Trait Implementations§
Source§impl Clone for CompressionConfig
impl Clone for CompressionConfig
Source§fn clone(&self) -> CompressionConfig
fn clone(&self) -> CompressionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompressionConfig
impl Debug for CompressionConfig
Auto Trait Implementations§
impl Freeze for CompressionConfig
impl RefUnwindSafe for CompressionConfig
impl Send for CompressionConfig
impl Sync for CompressionConfig
impl Unpin for CompressionConfig
impl UnwindSafe for CompressionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging