Function ZSTD_compress2
unsafe extern C { unwind: false } fn ZSTD_compress2(cctx: *mut ZSTD_CCtx, dst: *mut c_void, dstCapacity: usize, src: *const c_void, srcSize: usize) -> usize
ZSTD_compress2() : Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. (note that this entry point doesn't even expose a compression level parameter). ZSTD_compress2() always starts a new frame. Should cctx hold data from a previously unfinished frame, everything about it is forgotten.
- Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
- The function is always blocking, returns when compression is completed.
NOTE: Providing
dstCapacity >= ZSTD_compressBound(srcSize)guarantees that zstd will have enough space to successfully compress the data, though it is possible it fails for other reasons. @return : compressed size written intodst(<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()).