]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | extern crate flate2; |
2 | ||
3 | use std::io::prelude::*; | |
4 | use flate2::Compression; | |
5 | use flate2::write::GzEncoder; | |
6 | ||
7 | // Vec<u8> implements Write to print the compressed bytes of sample string | |
8 | fn main() { | |
ff7c6d11 | 9 | let mut e = GzEncoder::new(Vec::new(), Compression::default()); |
b7449926 | 10 | e.write_all(b"Hello World").unwrap(); |
ea8adc8c XL |
11 | println!("{:?}", e.finish().unwrap()); |
12 | } |