summaryrefslogtreecommitdiffstats
path: root/third_party/rust/flate2/examples/zlibencoder-write.rs
blob: 76bcf17b17b1d99e0fa5d2f7e669ef36b4f45da3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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());
}