[−][src]Module roa::compress
The compress module of roa.
This module provides a middleware Compress
.
Example
use roa::compress::{Compress, Level}; use roa::body::DispositionType::*; use roa::App; use roa::preload::*; let (addr, server) = App::new(()) .gate(Compress(Level::Fastest)) .end(|mut ctx| async move { ctx.write_file("../assets/welcome.html", Inline).await }) .run()?; // server.await Ok(())
Structs
Compress | A middleware to negotiate with client and compress response body automatically, supports gzip, deflate, brotli, zstd and identity. |
Enums
Level | Level of compression data should be compressed with. |