hydraulic 0.1.0

An interface for generic compression library usage with a collection (unimplemented so far) of pre-existing compression libraries
Documentation
use std::fs::File;
use std::io::Read;
use hydraulic::Gzip;
use hydraulic::prelude::*;

fn main() {
    let data = vec![2u8; 32];

    let f = compress(&*data);

    println!("{:?}", f.bytes());
}

fn compress(data: &[u8]) -> File {

    // Create a new Gzip class with default values
    let alg = Gzip::default();

    // Create a new compressor which writes data to "foo.txt"
    let mut compressor = WriteEncoder::new(&alg, File::create("../../foo.txt").unwrap(), CompressionLevel::High);

    // Send "data" to the buffer
    compressor.queue(&data);

    // Compress and write the buffer to "foo.txt"
    compressor.write().unwrap();

    // Finalises the compression and returns the file where data is written
    let finalised = compressor.finish().unwrap();

    finalised
}