Skip to main content

AdaptiveCompressionStrategy

Trait AdaptiveCompressionStrategy 

Source
pub trait AdaptiveCompressionStrategy: CompressionStrategy {
    // Required methods
    fn train(&mut self, training_data: &[&[u8]]) -> Result<(), Self::Error>;
    fn learning_progress(&self) -> f64;
    fn save_model(&self) -> Result<Vec<u8>, Self::Error>;
    fn load_model(&mut self, model_data: &[u8]) -> Result<(), Self::Error>;
    fn learning_info(&self) -> LearningInfo;
}
Expand description

A trait for adaptive compression strategies that learn from data

Required Methods§

Source

fn train(&mut self, training_data: &[&[u8]]) -> Result<(), Self::Error>

Train the compressor on a dataset

Source

fn learning_progress(&self) -> f64

Get the current learning progress (0.0 to 1.0)

Source

fn save_model(&self) -> Result<Vec<u8>, Self::Error>

Save the learned model to bytes

Source

fn load_model(&mut self, model_data: &[u8]) -> Result<(), Self::Error>

Load a previously learned model from bytes

Source

fn learning_info(&self) -> LearningInfo

Get information about what the algorithm has learned

Implementors§