pub fn compress(src: &[u8], dst: &mut [u8]) -> Result<usize, String> {
    unsafe {
        let mut dst_len = snappy_max_compressed_length(src.len());
        if dst.len() < dst_len {
            return Err(format!(
                "destination buffer too small ({} < {})",
                dst.len(),
                dst_len
            ));
        }
        snappy_compress(
            src.as_ptr(),
            src.len(),
            dst.as_mut_ptr(),
            &mut dst_len,
        );
        Ok(dst_len)
    }
}
Compress the bytes in `src` into `dst`. `dst` must be big enough to
hold the maximum compressed size of the bytes in `src`.

If there was a problem compressing `src`, an error is returned.
snappy-cpp/src/lib.rs