pub struct AdaptiveCompressor { /* private fields */ }Expand description
Adaptive compressor that selects best codec
Implementations§
Source§impl AdaptiveCompressor
impl AdaptiveCompressor
Sourcepub fn with_level(self, level: CompressionLevel) -> Self
pub fn with_level(self, level: CompressionLevel) -> Self
Set compression level
Sourcepub fn with_min_size(self, size: usize) -> Self
pub fn with_min_size(self, size: usize) -> Self
Set minimum compression size
Sourcepub fn compress(
&mut self,
data: &[u8],
codec: CompressionCodec,
data_type: DataType,
) -> Result<Bytes>
pub fn compress( &mut self, data: &[u8], codec: CompressionCodec, data_type: DataType, ) -> Result<Bytes>
Compress data with specified codec
Sourcepub fn decompress(
&mut self,
data: &[u8],
codec: CompressionCodec,
) -> Result<Bytes>
pub fn decompress( &mut self, data: &[u8], codec: CompressionCodec, ) -> Result<Bytes>
Decompress data with specified codec
Sourcepub fn select_codec(&self, data_type: DataType) -> CompressionCodec
pub fn select_codec(&self, data_type: DataType) -> CompressionCodec
Select best codec for data type based on historical performance
Sourcepub fn avg_compression_ratio(
&self,
codec: CompressionCodec,
data_type: DataType,
) -> Option<f64>
pub fn avg_compression_ratio( &self, codec: CompressionCodec, data_type: DataType, ) -> Option<f64>
Get average compression ratio for a codec and data type
Sourcepub fn get_performance_stats(
&self,
) -> HashMap<(CompressionCodec, DataType), PerformanceMetrics>
pub fn get_performance_stats( &self, ) -> HashMap<(CompressionCodec, DataType), PerformanceMetrics>
Get performance statistics for all codecs
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear all performance history
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdaptiveCompressor
impl RefUnwindSafe for AdaptiveCompressor
impl Send for AdaptiveCompressor
impl Sync for AdaptiveCompressor
impl Unpin for AdaptiveCompressor
impl UnsafeUnpin for AdaptiveCompressor
impl UnwindSafe for AdaptiveCompressor
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> 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