pub fn is_error_kind(code: ErrorCode, kind: ZSTD_ErrorCode) -> boolExpand description
Returns whether code is an error of the given kind.
The kinds are those of zstd_sys::ZSTD_ErrorCode, listed in
zstd_errors.h.
This goes from kind to a code rather than the other way around, so it
works whatever the version of the linked libzstd: a code these bindings
don’t know is just not equal to any kind.
use zstd_safe::zstd_sys::ZSTD_ErrorCode;
let mut small = [0u8; 4];
let code = zstd_safe::compress(&mut small[..], &[42u8; 1000], 3).unwrap_err();
assert!(zstd_safe::is_error_kind(code, ZSTD_ErrorCode::ZSTD_error_dstSize_tooSmall));