Function miniz_oxide::deflate::core::compress

source ·
pub fn compress(
    d: &mut CompressorOxide,
    in_buf: &[u8],
    out_buf: &mut [u8],
    flush: TDEFLFlush
) -> (TDEFLStatus, usize, usize)
Expand description

Main compression function. Tries to compress as much as possible from in_buf and puts compressed output into out_buf.

The value of flush determines if the compressor should attempt to flush all output and alternatively try to finish the stream.

Use TDEFLFlush::Finish on the final call to signal that the stream is finishing.

Note that this function does not keep track of whether a flush marker has been output, so if called using TDEFLFlush::Sync, the caller needs to ensure there is enough space in the output buffer if they want to avoid repeated flush markers. See #105 for details.

Returns

Returns a tuple containing the current status of the compressor, the current position in the input buffer and the current position in the output buffer.