.cargo/vendor/weezl/examples/lzw-compress.rs
raw| 1 | //! Compresses the input from stdin and writes the result to stdout. |
| 2 | |
| 3 | use std::io::{self, BufWriter}; |
| 4 | |
| 5 | fn main() { |
| 6 | match { |
| 7 | let mut encoder = weezl::encode::Encoder::new(weezl::BitOrder::Msb, 8); |
| 8 | let stdin = io::stdin(); |
| 9 | let stdin = stdin.lock(); |
| 10 | let stdout = io::stdout(); |
| 11 | let stdout = BufWriter::new(stdout.lock()); |
| 12 | encoder.into_stream(stdout).encode_all(stdin).status |
| 13 | } { |
| 14 | Ok(()) => (), |
| 15 | Err(err) => eprintln!("{}", err), |
| 16 | } |
| 17 | } |