Struct tide_compress::CompressMiddleware
source · [−]pub struct CompressMiddleware { /* private fields */ }
Expand description
A middleware for compressing response body data.
Example
let mut app = tide::new();
app.with(tide_compress::CompressMiddleware::new());
Implementations
sourceimpl CompressMiddleware
impl CompressMiddleware
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new CompressMiddleware.
Uses the defaults:
- Minimum body size threshold (1024 bytes).
- Check for
Content-Type
header match^text/|\+(?:json|text|xml)$
(case insensitive).
Example
let mut app = tide::new();
app.with(tide_compress::CompressMiddleware::new());
sourcepub fn builder() -> CompressMiddlewareBuilder
pub fn builder() -> CompressMiddlewareBuilder
Used to create a new CompressMiddleware with custom settings.
sourcepub fn set_threshold(&mut self, threshold: usize)
pub fn set_threshold(&mut self, threshold: usize)
Sets the minimum body size threshold value.
sourcepub fn set_content_type_check(&mut self, content_type_check: Option<Regex>)
pub fn set_content_type_check(&mut self, content_type_check: Option<Regex>)
Sets the Content-Type
header (MIME) check regular expression.
sourcepub fn content_type_check(&self) -> Option<&Regex>
pub fn content_type_check(&self) -> Option<&Regex>
Gets a reference to the existing Content-Type
header (MIME) check regular expression.
Trait Implementations
sourceimpl Clone for CompressMiddleware
impl Clone for CompressMiddleware
sourcefn clone(&self) -> CompressMiddleware
fn clone(&self) -> CompressMiddleware
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CompressMiddleware
impl Debug for CompressMiddleware
sourceimpl Default for CompressMiddleware
impl Default for CompressMiddleware
sourceimpl From<CompressMiddlewareBuilder> for CompressMiddleware
impl From<CompressMiddlewareBuilder> for CompressMiddleware
sourcefn from(builder: CompressMiddlewareBuilder) -> Self
fn from(builder: CompressMiddlewareBuilder) -> Self
Converts to this type from the input type.
sourceimpl<State: Clone + Send + Sync + 'static> Middleware<State> for CompressMiddleware
impl<State: Clone + Send + Sync + 'static> Middleware<State> for CompressMiddleware
Auto Trait Implementations
impl RefUnwindSafe for CompressMiddleware
impl Send for CompressMiddleware
impl Sync for CompressMiddleware
impl Unpin for CompressMiddleware
impl UnwindSafe for CompressMiddleware
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more