pub struct CompressionConfig {
pub min_bytes: usize,
pub level: CompressionLevel,
}Expand description
Compression configuration.
Used to configure compression behavior for both client and server.
Fields§
§min_bytes: usizeMinimum bytes before compression is applied. Default is 0 (compress everything), matching connect-go behavior. Messages smaller than this threshold are sent uncompressed.
level: CompressionLevelCompression level/quality.
Implementations§
Source§impl CompressionConfig
impl CompressionConfig
Sourcepub fn new(min_bytes: usize) -> CompressionConfig
pub fn new(min_bytes: usize) -> CompressionConfig
Create a new compression config with the specified minimum bytes threshold.
Sourcepub fn level(self, level: CompressionLevel) -> CompressionConfig
pub fn level(self, level: CompressionLevel) -> CompressionConfig
Set the compression level.
Sourcepub fn disabled() -> CompressionConfig
pub fn disabled() -> CompressionConfig
Disable compression by setting threshold to usize::MAX.
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Check if compression is effectively disabled.
Trait Implementations§
Source§impl Clone for CompressionConfig
impl Clone for CompressionConfig
Source§fn clone(&self) -> CompressionConfig
fn clone(&self) -> CompressionConfig
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 CompressionConfig
impl Debug for CompressionConfig
Source§impl Default for CompressionConfig
impl Default for CompressionConfig
Source§fn default() -> CompressionConfig
fn default() -> CompressionConfig
Returns the “default value” for a type. Read more
impl Copy for CompressionConfig
Auto Trait Implementations§
impl Freeze for CompressionConfig
impl RefUnwindSafe for CompressionConfig
impl Send for CompressionConfig
impl Sync for CompressionConfig
impl Unpin for CompressionConfig
impl UnsafeUnpin for CompressionConfig
impl UnwindSafe for CompressionConfig
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