aboutsummaryrefslogtreecommitdiff
path: root/vendor/weezl/examples/lzw-decompress.rs
blob: 12cbc367cfa33229b205f602bcba368b82daf916 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Decompresses the input from stdin and writes the result to stdout.

use std::io::{self, BufWriter};

fn main() {
    match {
        let mut decoder = weezl::decode::Decoder::new(weezl::BitOrder::Msb, 8);
        let stdout = io::stdout();
        let stdout = BufWriter::new(stdout.lock());
        let stdin = io::stdin();
        let stdin = stdin.lock();
        decoder.into_stream(stdout).decode_all(stdin).status
    } {
        Ok(()) => (),
        Err(err) => eprintln!("{}", err),
    }
}