pub enum CompressionLevel {
Fastest,
Fast,
Balanced,
Best,
Custom(u32),
}Expand description
Compression level settings that balance processing speed vs. compression ratio
This enum provides predefined compression levels optimized for different use cases, allowing users to choose the appropriate trade-off between compression speed and the resulting compression ratio.
§Level Characteristics
- Fastest: Minimal compression for maximum speed (level 1-2)
- Fast: Light compression with good speed (level 3-4)
- Balanced: Optimal balance of speed and compression (level 5-6)
- Best: Maximum compression ratio, slower processing (level 9-11)
- Custom: User-defined level for fine-tuned control
§Performance Impact
Higher compression levels generally result in:
- Better compression ratios (smaller output)
- Increased processing time
- Higher memory usage
- More CPU utilization
§Examples
Variants§
Fastest
Fastest compression with minimal ratio optimization Suitable for real-time processing and streaming applications
Fast
Fast compression with light optimization Good for interactive applications requiring quick response
Balanced
Balanced compression optimizing both speed and ratio Recommended for most general-purpose applications
Best
Best compression ratio with slower processing Ideal for archival storage and bandwidth-limited scenarios
Custom(u32)
Custom compression level for fine-tuned control Value interpretation depends on the specific algorithm
Implementations§
Source§impl CompressionLevel
impl CompressionLevel
Sourcepub fn to_numeric(&self, algorithm: &CompressionAlgorithm) -> u32
pub fn to_numeric(&self, algorithm: &CompressionAlgorithm) -> u32
Gets the numeric level for the compression algorithm
Trait Implementations§
Source§impl Clone for CompressionLevel
impl Clone for CompressionLevel
Source§fn clone(&self) -> CompressionLevel
fn clone(&self) -> CompressionLevel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompressionLevel
impl Debug for CompressionLevel
Source§impl Display for CompressionLevel
impl Display for CompressionLevel
Source§impl PartialEq for CompressionLevel
impl PartialEq for CompressionLevel
impl Copy for CompressionLevel
impl StructuralPartialEq for CompressionLevel
Auto Trait Implementations§
impl Freeze for CompressionLevel
impl RefUnwindSafe for CompressionLevel
impl Send for CompressionLevel
impl Sync for CompressionLevel
impl Unpin for CompressionLevel
impl UnwindSafe for CompressionLevel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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