pub struct AdaptiveCompressor { /* private fields */ }
Expand description
Adaptive compressor that learns and improves over time
Implementations§
Source§impl AdaptiveCompressor
impl AdaptiveCompressor
Sourcepub fn new(
config: AdaptiveConfig,
requirements: PerformanceRequirements,
) -> Result<Self>
pub fn new( config: AdaptiveConfig, requirements: PerformanceRequirements, ) -> Result<Self>
Create a new adaptive compressor
Sourcepub fn default_with_requirements(
requirements: PerformanceRequirements,
) -> Result<Self>
pub fn default_with_requirements( requirements: PerformanceRequirements, ) -> Result<Self>
Create with default configuration
Sourcepub fn compress(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn compress(&self, data: &[u8]) -> Result<Vec<u8>>
Compress data with adaptive algorithm selection
Sourcepub fn stats(&self) -> CompressionStats
pub fn stats(&self) -> CompressionStats
Get current compression statistics
Sourcepub fn current_algorithm(&self) -> Algorithm
pub fn current_algorithm(&self) -> Algorithm
Get current algorithm
Sourcepub fn set_algorithm(&mut self, algorithm: Algorithm) -> Result<()>
pub fn set_algorithm(&mut self, algorithm: Algorithm) -> Result<()>
Force adaptation to a specific algorithm
Sourcepub fn profiles(&self) -> HashMap<String, CompressionProfile>
pub fn profiles(&self) -> HashMap<String, CompressionProfile>
Get compression profiles
Trait Implementations§
Source§impl Compressor for AdaptiveCompressor
impl Compressor for AdaptiveCompressor
Source§fn estimate_ratio(&self, data: &[u8]) -> f64
fn estimate_ratio(&self, data: &[u8]) -> f64
Estimate compression ratio for given data
Source§fn is_suitable(
&self,
requirements: &PerformanceRequirements,
data_size: usize,
) -> bool
fn is_suitable( &self, requirements: &PerformanceRequirements, data_size: usize, ) -> bool
Check if this compressor is suitable for the given requirements
Auto Trait Implementations§
impl Freeze for AdaptiveCompressor
impl RefUnwindSafe for AdaptiveCompressor
impl Send for AdaptiveCompressor
impl Sync for AdaptiveCompressor
impl Unpin 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