Skip to main content

hyperlane_plugin_negotiate/
struct.rs

1/// The configuration of [`CompressMiddleware`].
2#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3pub struct CompressConfig {
4    /// The body length below which a response is answered without a content coding.
5    pub(crate) min_length: usize,
6}
7
8/// The middleware that answers with the content coding the client accepts.
9///
10/// # Examples
11///
12/// ```rust
13/// use hyperlane::Server;
14/// use hyperlane_plugin_negotiate::CompressMiddleware;
15///
16/// let mut server: Server = Server::default();
17/// server.response_middleware::<CompressMiddleware>();
18/// ```
19#[derive(Clone, Copy, Debug, Default)]
20pub struct CompressMiddleware;
21
22/// The middleware that answers a conditional request with `304 Not Modified`.
23#[derive(Clone, Copy, Debug, Default)]
24pub struct ConditionalMiddleware;
25
26/// A strong entity-tag of a representation.
27#[derive(Clone, Debug, Eq, PartialEq)]
28pub struct EntityTag(pub(crate) String);