tycho 0.1.2

A minimal, self-describing and traversable binary data format designed around rust and the serde data model.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use flate2::write::GzEncoder;
use flate2::Compression;
use crate::error::{TychoResult, TychoError};
use std::io::Write;

pub(crate) fn compress(bytes: Vec<u8>) -> TychoResult<Vec<u8>> {
    let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
    encoder.write_all(&bytes)?;
    match encoder.finish() {
        Ok(x) => Ok(x),
        Err(e) => Err(TychoError::Io(e))
    }
}