ignite 0.1.6

ignite serves the role as a "batteries included" addon to stdlib providing useful stuff and higher level functions along with abstractions.
Documentation
use snap;

/// Handles compression of bytes and such.
pub struct Compressor;

impl Compressor {
    /// Compress bytes if compression is enabled.
    #[inline(always)]
    pub fn compress_bytes(bytes: Vec<u8>, compression: bool) -> Vec<u8> {
        if compression {
            let mut encoder = snap::Encoder::new();

            encoder.compress_vec(&bytes[..]).unwrap()
        } else {
            bytes
        }
    }

    /// Decompress bytes if compression is enabled.
    #[inline(always)]
    pub fn decompress_bytes(bytes: Vec<u8>, compression: bool) -> Vec<u8> {
        if compression {
            let mut decoder = snap::Decoder::new();

            decoder.decompress_vec(&bytes[..]).unwrap()
        } else {
            bytes
        }
    }
}