pub struct CompressionMiddleware { /* private fields */ }Implementations§
Source§impl CompressionMiddleware
impl CompressionMiddleware
pub fn new(config: CompressionConfig) -> Self
Sourcepub fn should_compress(&self, content_type: &str, content_length: usize) -> bool
pub fn should_compress(&self, content_type: &str, content_length: usize) -> bool
Check if content should be compressed based on content type and size
Sourcepub fn compress(
&self,
content: &[u8],
method: CompressionMethod,
) -> Result<Bytes, Box<dyn Error>>
pub fn compress( &self, content: &[u8], method: CompressionMethod, ) -> Result<Bytes, Box<dyn Error>>
Compress content using the specified method
Sourcepub fn get_best_compression(
&self,
accept_encoding: Option<&str>,
) -> CompressionMethod
pub fn get_best_compression( &self, accept_encoding: Option<&str>, ) -> CompressionMethod
Get the best compression method based on Accept-Encoding header
Sourcepub fn is_compressible_type(&self, content_type: &str) -> bool
pub fn is_compressible_type(&self, content_type: &str) -> bool
Check if a content type is compressible
Auto Trait Implementations§
impl Freeze for CompressionMiddleware
impl RefUnwindSafe for CompressionMiddleware
impl Send for CompressionMiddleware
impl Sync for CompressionMiddleware
impl Unpin for CompressionMiddleware
impl UnwindSafe for CompressionMiddleware
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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