Skip to main content

CompressorOxide

Struct CompressorOxide 

Source
pub struct CompressorOxide { /* private fields */ }
Expand description

Main compression struct.

Implementations§

Source§

impl CompressorOxide

Source

pub fn new(flags: u32) -> Self

Create a new CompressorOxide with the given flags.

§Notes

This function may be changed to take different parameters in the future.

Source

pub fn with_format_and_level( data_format: DataFormat, level: CompressionLevel, ) -> CompressorOxide

Create a new CompressorOxide with the given flags.

Source

pub fn with_params( data_format: DataFormat, level: u8, strategy: CompressionStrategy, window_bits: u8, ) -> CompressorOxide

Create a new ’CompressorOxide with the current format, level, strategy and window bits

Level will is limited to 10, and window bits is clamped to 15

Source

pub const fn adler32(&self) -> u32

Get the adler32 checksum of the currently encoded data.

Source

pub const fn prev_return_status(&self) -> TDEFLStatus

Get the return status of the previous compress call with this compressor.

Source

pub const fn flags(&self) -> i32

Get the raw compressor flags.

§Notes

This function may be deprecated or changed in the future to use more rust-style flags.

Source

pub const fn data_format(&self) -> DataFormat

Returns whether the compressor is wrapping the data in a zlib format or not.

Source

pub fn reset(&mut self)

Reset the state of the compressor, keeping the same parameters.

This avoids re-allocating data.

Source

pub fn set_compression_level(&mut self, level: CompressionLevel)

Set the compression level of the compressor.

Changing compression level after compression has started will likely result in failure.

§Notes

The compression strategy will be reset to the default one when this is called.

If using the zlib wrapper, increasing the compression level to one that requires a higher window_bits value than the max set at initialization will fail and leave the compressor at the current level.

Source

pub fn set_compression_level_raw(&mut self, level: u8)

Set the compression level of the compressor using an integer value.

Changing compression level after compression has started will likely result in failure.

§Notes

The compression strategy will be reset to the default one when this is called.

If using the zlib wrapper, increasing the compression level to one that requires a higher window_bits value than the max set at initialization will fail and leave the compressor at the current level.

Source

pub fn set_format_and_level(&mut self, data_format: DataFormat, level: u8)

Update the compression settings of the compressor.

Changing the DataFormat after compression has started will result in a corrupted stream.

Changing compression level after compression has started will likely result in failure.

§Notes

This function mainly intended for setting the initial settings after e.g creating with default or after calling CompressorOxide::reset(), and behaviour may be changed to disallow calling it after starting compression in the future.

If using the zlib wrapper, increasing the compression level to one that requires a higher window_bits value than the max set at initialization will fail and leave the compressor at the current level.

Source

pub const fn unwritten_bit_count(&self) -> u32

Check the number of unwritten bits after the last flush. After a NoSync flush it can be used to test whether the stream is aligned with a byte boundary.

Trait Implementations§

Source§

impl Clone for CompressorOxide

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CompressorOxide

Source§

fn default() -> Self

Initialize the compressor with a level of 4, zlib wrapper and the default strategy.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.