pub struct AdaptiveSelector {
pub ratio_threshold: f64,
pub sample_size: usize,
}Expand description
Adaptive compression selector.
Samples the first N bytes of input, compresses with each available
compressor, and picks the one with the best ratio (if it meets
the threshold). Falls back to NoCompression if nothing helps.
Fields§
§ratio_threshold: f64Minimum compression ratio (compressed/original) to justify compression. E.g., 0.9 means compression must achieve at least 10% reduction.
sample_size: usizeMaximum sample size (bytes) for the trial compression.
Implementations§
Source§impl AdaptiveSelector
impl AdaptiveSelector
Sourcepub fn select(
&self,
data: &[u8],
registry: &CompressorRegistry,
) -> CompressionType
pub fn select( &self, data: &[u8], registry: &CompressorRegistry, ) -> CompressionType
Given a payload, select the best compressor from the registry. Returns the compression type to use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdaptiveSelector
impl RefUnwindSafe for AdaptiveSelector
impl Send for AdaptiveSelector
impl Sync for AdaptiveSelector
impl Unpin for AdaptiveSelector
impl UnsafeUnpin for AdaptiveSelector
impl UnwindSafe for AdaptiveSelector
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