pub struct CompressionOptions {
pub min_body_bytes: usize,
pub level: Option<u32>,
}Expand description
Compression options for response bodies (server) and outgoing requests (client; reserved).
Lives in this module because it configures the compression layer in
[build_stack]/[build_client_stack]. Re-exported from the crate root
so adapter callsites are unchanged.
Fields§
§min_body_bytes: usizeMinimum body size in bytes before compression is applied.
Default: CompressionOptions::DEFAULT_MIN_BODY_BYTES (1 KiB).
level: Option<u32>Zstd compression level (1–22). None uses the zstd default (3).
Implementations§
Source§impl CompressionOptions
impl CompressionOptions
Sourcepub const DEFAULT_MIN_BODY_BYTES: usize = 1024
pub const DEFAULT_MIN_BODY_BYTES: usize = 1024
Default minimum body size before compression is applied.
1 KiB. Matches the documented default and the threshold most HTTP servers tune to: below ~1 KiB the CPU cost of compression typically outweighs the bandwidth savings on a single TCP/QUIC packet.
Trait Implementations§
Source§impl Clone for CompressionOptions
impl Clone for CompressionOptions
Source§fn clone(&self) -> CompressionOptions
fn clone(&self) -> CompressionOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompressionOptions
impl Debug for CompressionOptions
Auto Trait Implementations§
impl Freeze for CompressionOptions
impl RefUnwindSafe for CompressionOptions
impl Send for CompressionOptions
impl Sync for CompressionOptions
impl Unpin for CompressionOptions
impl UnsafeUnpin for CompressionOptions
impl UnwindSafe for CompressionOptions
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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