Struct lzxd::Lzxd

source ·
pub struct Lzxd { /* private fields */ }
Expand description

The main interface to perform LZXD decompression.

This structure stores the required state to process the compressed chunks of data in a sequential order.

use ::lzxd::{Lzxd, WindowSize};

let mut lzxd = Lzxd::new(WindowSize::KB64);

while let Some((chunk, output_size)) = get_compressed_chunk() {
    let decompressed = lzxd.decompress_next(&chunk, output_size);
    write_data(decompressed.unwrap());
}

Implementations§

source§

impl Lzxd

source

pub fn new(window_size: WindowSize) -> Self

Creates a new instance of the LZXD decoder state. The WindowSize must be obtained from elsewhere (e.g. it may be predetermined to a certain value), and if it’s wrong, the decompressed values won’t be those expected.

source

pub fn decompress_next( &mut self, chunk: &[u8], output_len: usize ) -> Result<&[u8], DecompressError>

Decompresses the next compressed chunk from the LZXD data stream.

source

pub fn reset(&mut self)

Resets the decoder state.

This is equivalent to calling Self::new with the same WindowSize. WindowSize: enum.WindowSize.html

Auto Trait Implementations§

§

impl RefUnwindSafe for Lzxd

§

impl Send for Lzxd

§

impl Sync for Lzxd

§

impl Unpin for Lzxd

§

impl UnwindSafe for Lzxd

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> 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, U> TryFrom<U> for T
where 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 T
where 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.