pub struct CompressionLevel(/* private fields */);Expand description
A zlib-compatible compression level from 0 (store only) to 9 (smallest).
Levels trade speed for size as zlib-ng’s do: level 0 emits stored blocks, level 1 one fixed-code block of the first matches found, level 2 greedy parsing, levels 3 to 6 greedy parsing with a look-ahead match and levels 7 to 9 lazy matching, with progressively longer hash-chain searches.
use pltrs_codec::CompressionLevel;
let level = CompressionLevel::new(6)?;
assert_eq!(level, CompressionLevel::DEFAULT);
assert!(CompressionLevel::new(10).is_err());Implementations§
Source§impl CompressionLevel
impl CompressionLevel
Sourcepub const fn new(level: u8) -> Result<Self, InvalidCompressionLevel>
pub const fn new(level: u8) -> Result<Self, InvalidCompressionLevel>
Returns the level level, which must be at most 9.
Trait Implementations§
Source§impl Clone for CompressionLevel
impl Clone for CompressionLevel
impl Copy for CompressionLevel
Source§impl Debug for CompressionLevel
impl Debug for CompressionLevel
Source§impl Default for CompressionLevel
impl Default for CompressionLevel
impl Eq for CompressionLevel
Source§impl From<CompressionLevel> for u8
impl From<CompressionLevel> for u8
Source§fn from(level: CompressionLevel) -> Self
fn from(level: CompressionLevel) -> Self
Converts to this type from the input type.
Source§impl Hash for CompressionLevel
impl Hash for CompressionLevel
Source§impl Ord for CompressionLevel
impl Ord for CompressionLevel
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for CompressionLevel
impl PartialEq for CompressionLevel
Source§impl PartialOrd for CompressionLevel
impl PartialOrd for CompressionLevel
impl StructuralPartialEq for CompressionLevel
Auto Trait Implementations§
impl Forget for CompressionLevel
impl Freeze for CompressionLevel
impl Move for CompressionLevel
impl RefUnwindSafe for CompressionLevel
impl Send for CompressionLevel
impl Sync for CompressionLevel
impl Unpin for CompressionLevel
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more