encoding-negotiator 10.3.0

A library that negotiates the content encoding of an HTTP answer. It picks the encoding a client asked for out of the encodings that are offered, and tells whether a body of a content type is worth compressing.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::*;

/// The rules that decide which encoding an answer carries.
///
/// The policy holds no server state, so the same rules can be used by any
/// server that answers with a compressed body.
#[derive(Clone, Debug, Getter)]
pub struct CompressionPolicy {
    /// The encodings that are offered, in the order they are preferred.
    pub encodings: Vec<String>,
    /// The smallest body that is worth compressing.
    #[get(type(copy))]
    pub min_size: usize,
}