pub struct RouteCompression {
pub algorithms: Vec<CompressionAlgorithm>,
pub min_length: u64,
pub content_types: Vec<String>,
}Expand description
A route’s compression declaration ([route.compression], ADR 000074). Every field has a safe
default, so the bare block header is the whole opt-in; the fields exist to narrow it.
Fields§
§algorithms: Vec<CompressionAlgorithm>The codings this route offers, in SERVER-PREFERENCE order — the tie-break when the
client’s qvalues don’t decide (RFC 9110 §12.5.3 orders only by qvalue). Default
["zstd", "br", "gzip"]: best ratio-per-CPU first, universal fallback last.
min_length: u64Don’t compress a response whose declared Content-Length is below this (bytes). Under
~1 KiB the codec dictionary + trailer can exceed the saving (common practice defaults
cluster around tens of bytes to ~1 KiB; 1024 is the safe middle). A response with NO
declared length (streamed / chunked) is always eligible — its size is unknowable up front.
content_types: Vec<String>The type/subtype allowlist (matched against the response Content-Type essence,
case-insensitive, parameters ignored). REPLACES the default when set. The default covers
the textual web types; already-compressed media (images, video, archives) and
text/event-stream (a compressor buffering an SSE stream stalls events) stay excluded.
Trait Implementations§
Source§impl Clone for RouteCompression
impl Clone for RouteCompression
Source§fn clone(&self) -> RouteCompression
fn clone(&self) -> RouteCompression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteCompression
impl Debug for RouteCompression
Source§impl<'de> Deserialize<'de> for RouteCompression
impl<'de> Deserialize<'de> for RouteCompression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RouteCompression
impl JsonSchema for RouteCompression
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for RouteCompression
impl RefUnwindSafe for RouteCompression
impl Send for RouteCompression
impl Sync for RouteCompression
impl Unpin for RouteCompression
impl UnsafeUnpin for RouteCompression
impl UnwindSafe for RouteCompression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more