Struct rscache::util::Huffman [−][src]
pub struct Huffman { /* fields omitted */ }
Expand description
Decompresses chat messages.
Implementations
Initializes the Huffman struct with the given sizes.
The sizes can be found in the cache.
Call the huffman_table()
function to get the huffman table which
contains the sizes needed to initialize this struct.
Examples
use rscache::util::Huffman;
let huffman_tbl = cache.huffman_table()?;
let huffman = Huffman::new(&huffman_tbl);
let compressed_msg = &[174, 128, 35, 32, 208, 96];
let decompressed_len = 8; // client will include this in the chat packet.
let decompressed_msg = huffman.decompress(compressed_msg, decompressed_len);
if let Ok(msg) = String::from_utf8(decompressed_msg) {
assert_eq!(msg, "rs-cache");
}
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Huffman
impl UnwindSafe for Huffman
Blanket Implementations
Mutably borrows from an owned value. Read more