13 lines
349 B
Rust
13 lines
349 B
Rust
extern crate flate2;
|
|
|
|
use flate2::write::ZlibEncoder;
|
|
use flate2::Compression;
|
|
use std::io::prelude::*;
|
|
|
|
// Vec<u8> implements Write to print the compressed bytes of sample string
|
|
fn main() {
|
|
let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
|
|
e.write_all(b"Hello World").unwrap();
|
|
println!("{:?}", e.finish().unwrap());
|
|
}
|