pub struct CompressionConfig {
pub min_size: usize,
pub encodings: Vec<Compress>,
}Expand description
The configuration of the compression plugin.
Fields§
§min_size: usizeThe smallest body that is worth compressing.
encodings: Vec<Compress>The encodings that are offered, in the order they are preferred.
Implementations§
Source§impl CompressionConfig
impl CompressionConfig
Sourcepub fn pick(&self, accept: &str) -> Option<Compress>
pub fn pick(&self, accept: &str) -> Option<Compress>
The encoding the client asked for, when one of the offered encodings is accepted.
The offered encodings are tried in the order they are preferred, so the first one the client accepts is the one that is used.
§Arguments
&str- Theaccept-encodingheader of the request.
§Returns
Option<Compress>- The encoding to answer with, when the client accepts one of the offered encodings.
Sourcepub fn is_compressible(&self, content_type: &str) -> bool
pub fn is_compressible(&self, content_type: &str) -> bool
Source§impl CompressionConfig
impl CompressionConfig
pub fn get_min_size(&self) -> usize
pub fn get_encodings(&self) -> &Vec<Compress>
Trait Implementations§
Source§impl Clone for CompressionConfig
impl Clone for CompressionConfig
Source§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 UnsafeUnpin for CompressionConfig
impl UnwindSafe for CompressionConfig
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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