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 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 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.

Using this to change level after compression has started is supported.

Notes

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

source

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

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

Using this to change level after compression has started is supported.

Notes

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

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.

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.

Trait Implementations§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.