pub struct Huffman { /* private fields */ }Expand description
Decompresses chat messages.
§Examples
use osrscache::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");
}Implementations§
Trait Implementations§
Source§impl Ord for Huffman
impl Ord for Huffman
Source§impl PartialOrd for Huffman
impl PartialOrd for Huffman
impl Eq for Huffman
impl StructuralPartialEq for Huffman
Auto Trait Implementations§
impl Freeze for Huffman
impl RefUnwindSafe for Huffman
impl Send for Huffman
impl Sync for Huffman
impl Unpin for Huffman
impl UnwindSafe for Huffman
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more