[][src]Function httlib_huffman::flattener::flatten

pub fn flatten(
    codings: &[(u8, u32)],
    speed: DecoderSpeed
) -> Vec<Vec<(Option<u8>, Option<u16>, u8)>>

Generates a translation matrix that can be used to decode an encoded content. The function expects the speed attribute which represents the number of bits that the decoder will read at a time when processing bytes. The speed attribute can be between 1 and 5 bits. The higher number will have a positive effect on performance but possibly a higher memory usage.

Example:

use httlib_huffman::DecoderSpeed;
use httlib_huffman::flattener::flatten;
use httlib_huffman::encoder::table::ENCODE_TABLE;
 
let speed = DecoderSpeed::FourBits; // decoder will read 4 bits at a time
let table = flatten(&ENCODE_TABLE, speed);