[][src]Function lz4::block::compress

pub fn compress(
    src: &[u8],
    mode: Option<CompressionMode>,
    prepend_size: bool
) -> Result<Vec<u8>>

Compresses the full src buffer using the specified CompressionMode, where None and Some(Default) are treated equally. If prepend_size is set, the source length will be prepended to the output buffer.

Errors

Returns std::io::Error with ErrorKind::InvalidInput if the src buffer is too long. Returns std::io::Error with ErrorKind::Other if the compression failed inside the C library. If this happens, the C api was not able to provide more information about the cause.