Function lzf::compress [] [src]

pub fn compress(data: &[u8]) -> LzfResult<Vec<u8>>

Compress the given data, if possible. The return value will be set to the error if compression fails.

The buffer is always set to the same size as the input buffer. If that is not enough to hold the lzf-compressed data, an error will be returned.

Example:

let data = "foobar";
let compressed = lzf::compress(data.as_bytes());