pub struct DataCompressionEngine { /* private fields */ }Expand description
Data compression engine
Implementations§
Source§impl DataCompressionEngine
impl DataCompressionEngine
pub fn new() -> Self
pub fn initialize(&mut self) -> Result<(), StatisticalError>
Sourcepub fn compress(&mut self, data: &[u8]) -> Result<Vec<u8>, StatisticalError>
pub fn compress(&mut self, data: &[u8]) -> Result<Vec<u8>, StatisticalError>
Compress data using a simple run-length encoding and record the
operation’s statistics (original size, compressed size, ratio, time).
Sourcepub fn decompress(&mut self, data: &[u8]) -> Result<Vec<u8>, StatisticalError>
pub fn decompress(&mut self, data: &[u8]) -> Result<Vec<u8>, StatisticalError>
Decompress data previously produced by compress and
record the decompression statistics.
Sourcepub fn get_statistics(&self) -> &CompressionStatistics
pub fn get_statistics(&self) -> &CompressionStatistics
Returns a reference to the cumulative compression statistics.
Sourcepub fn reset_statistics(&mut self)
pub fn reset_statistics(&mut self)
Resets all accumulated compression statistics to zero.
Sourcepub fn compression_algorithms(&self) -> &[CompressionAlgorithm]
pub fn compression_algorithms(&self) -> &[CompressionAlgorithm]
Returns the list of compression algorithms available to this engine.
Sourcepub fn add_compression_algorithm(&mut self, algorithm: CompressionAlgorithm)
pub fn add_compression_algorithm(&mut self, algorithm: CompressionAlgorithm)
Register an additional compression algorithm.
Sourcepub fn supports_algorithm(&self, algorithm: &CompressionAlgorithm) -> bool
pub fn supports_algorithm(&self, algorithm: &CompressionAlgorithm) -> bool
Returns true when the given algorithm is registered.
Auto Trait Implementations§
impl Freeze for DataCompressionEngine
impl RefUnwindSafe for DataCompressionEngine
impl Send for DataCompressionEngine
impl Sync for DataCompressionEngine
impl Unpin for DataCompressionEngine
impl UnsafeUnpin for DataCompressionEngine
impl UnwindSafe for DataCompressionEngine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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