Module lzokay::compress[][src]

Expand description

Compression routines

Available with feature compress.

compress and compress_with_dict available with features std and/or alloc.

Examples

Compressing a buffer into a heap-allocated vector:

use lzokay::compress::*;

let dst: Vec<u8> = compress(&input)?;

Several compression calls with shared dictionary, avoiding needless work:

use lzokay::compress::*;

let mut dict = new_dict();
let dst1 = compress_with_dict(&input1, &mut dict)?;
let dst2 = compress_with_dict(&input2, &mut dict)?;

#![no_std] compatible compression:

use lzokay::compress::*;

// Allocate dst on stack, with worst-case compression size
let mut dst = [0u8; compress_worst_size(input.len())];
// Allocate dictionary storage on stack
let mut storage = [0u8; dict_storage_size()];
// Create dictionary from storage
let mut dict = dict_from_storage(&mut storage);
let size = compress_no_alloc(&input, &mut dst, &mut dict)?;

Structs

Dictionary type

Functions

Compress the supplied buffer into a heap-allocated vector.

Compress the supplied buffer.

Compress the supplied buffer into a heap-allocated vector, with the supplied pre-allocated dictionary.

Worst-case compression size.

Creates a dictionary from the supplied storage.

Dictionary storage size, for manual or stack allocation.

Creates a new heap-allocated dictionary.