pub struct CompressionMiddleware;Expand description
Compression Middleware
Currently either compresses using brotli, gzip or deflate algorithms. The algorithm is
chosen by evaluating the AcceptEncoding header sent by the client.
§Example
extern crate iron;
extern crate iron_pack;
use iron::prelude::*;
use iron_pack::CompressionMiddleware;
fn a_lot_of_batman(_: &mut Request) -> IronResult<Response> {
let nana = "Na".repeat(5000);
Ok(Response::with((iron::status::Ok, format!("{}, Batman!", nana))))
}
fn main() {
let mut chain = Chain::new(a_lot_of_batman);
chain.link_after(CompressionMiddleware);
Iron::new(chain).http("localhost:3000").unwrap();
}Trait Implementations§
Source§impl AfterMiddleware for CompressionMiddleware
impl AfterMiddleware for CompressionMiddleware
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<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