summaryrefslogtreecommitdiffstats
path: root/vendor/flate2/examples/gzencoder-write.rs
blob: 275b010c5f9643499833b1f3d04cd8d157f3922b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
extern crate flate2;

use flate2::write::GzEncoder;
use flate2::Compression;
use std::io::prelude::*;

// Vec<u8> implements Write to print the compressed bytes of sample string
fn main() {
    let mut e = GzEncoder::new(Vec::new(), Compression::default());
    e.write_all(b"Hello World").unwrap();
    println!("{:?}", e.finish().unwrap());
}