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