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
impl Lzxd
sourcepub fn new(window_size: WindowSize) -> Self
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.
sourcepub fn decompress_next(
&mut self,
chunk: &[u8],
output_len: usize
) -> Result<&[u8], DecompressError>
pub fn decompress_next( &mut self, chunk: &[u8], output_len: usize ) -> Result<&[u8], DecompressError>
Decompresses the next compressed chunk
from the LZXD data stream.
sourcepub fn reset(&mut self)
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> 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