[−][src]Struct compression::prelude::LzssDecoder
Examples
use compression::prelude::*; use std::cmp::Ordering; fn main() { pub fn comparison(lhs: LzssCode, rhs: LzssCode) -> Ordering { match (lhs, rhs) { ( LzssCode::Reference { len: llen, pos: lpos, }, LzssCode::Reference { len: rlen, pos: rpos, }, ) => ((llen << 3) + rpos).cmp(&((rlen << 3) + lpos)).reverse(), (LzssCode::Symbol(_), LzssCode::Symbol(_)) => Ordering::Equal, (_, LzssCode::Symbol(_)) => Ordering::Greater, (LzssCode::Symbol(_), _) => Ordering::Less, } } let compressed = b"aabbaabbaabbaabb\n" .into_iter() .cloned() .encode(&mut LzssEncoder::new(comparison, 0x1_0000, 256, 3, 3), Action::Finish) .collect::<Result<Vec<_>, _>>() .unwrap(); let decompressed = compressed .iter() .cloned() .decode(&mut LzssDecoder::new(0x1_0000)) .collect::<Result<Vec<_>, _>>() .unwrap(); }
Methods
impl LzssDecoder
[src]
pub fn new(size_of_window: usize) -> Self
[src]
pub fn with_dict(size_of_window: usize, dict: &[u8]) -> Self
[src]
Trait Implementations
impl Decoder for LzssDecoder
[src]
type Input = LzssCode
type Error = CompressionError
type Output = u8
fn next<I: Iterator<Item = Self::Input>>(
&mut self,
s: &mut I
) -> Option<Result<Self::Output, Self::Error>>
[src]
&mut self,
s: &mut I
) -> Option<Result<Self::Output, Self::Error>>
impl Debug for LzssDecoder
[src]
Auto Trait Implementations
impl Send for LzssDecoder
impl Sync for LzssDecoder
impl Unpin for LzssDecoder
impl UnwindSafe for LzssDecoder
impl RefUnwindSafe for LzssDecoder
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,