#[non_exhaustive]pub enum Error {
Show 13 variants
SrcSizeWrong,
UnknownMagic(u32),
FrameHeaderInvalid(&'static str),
WindowTooLarge,
BlockTypeInvalid,
Corrupted(&'static str),
ChecksumMismatch {
expected: u32,
actual: u32,
},
DictionaryRequired(u32),
DictionaryWrong {
expected: u32,
actual: u32,
},
DictionaryCorrupted,
FrameContentSizeMismatch,
OutputTooLarge,
Encode(&'static str),
}Expand description
Errors produced while decoding a Zstandard stream.
The taxonomy intentionally mirrors the error conditions of the C libzstd
(ZSTD_ErrorCode) so that accept/reject behavior can be compared in
differential tests.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SrcSizeWrong
The input ended before a complete frame could be decoded
(ZSTD_error_srcSize_wrong).
UnknownMagic(u32)
The first four bytes of a frame are neither the Zstandard magic
number nor a skippable-frame magic (ZSTD_error_prefix_unknown).
FrameHeaderInvalid(&'static str)
The frame header violates the specification
(ZSTD_error_frameParameter_unsupported).
WindowTooLarge
The declared window size exceeds what this decoder supports
(ZSTD_error_frameParameter_windowTooLarge).
BlockTypeInvalid
A block used the reserved block type (ZSTD_error_corruption_detected).
Corrupted(&'static str)
The compressed data is malformed (ZSTD_error_corruption_detected).
ChecksumMismatch
The frame’s XXH64 content checksum did not match
(ZSTD_error_checksum_wrong).
DictionaryRequired(u32)
The frame was compressed with a dictionary, but none was supplied to
the decoder (ZSTD_error_dictionary_wrong). The payload is the
dictionary ID the frame asks for.
DictionaryWrong
A dictionary was supplied, but its ID does not match the one the frame
requires (ZSTD_error_dictionary_wrong).
DictionaryCorrupted
A supplied dictionary buffer began with the ZDICT magic but could not
be parsed (ZSTD_error_dictionary_corrupted).
FrameContentSizeMismatch
The frame declared a content size that does not match the number of
bytes actually regenerated (ZSTD_error_corruption_detected).
OutputTooLarge
Decoding would exceed the output limit given to
decompress_with_limit.
Encode(&'static str)
An internal invariant was violated while encoding — e.g. a table log
out of range, or a distribution that does not normalize
(ZSTD_error_GENERIC on the compression path). Reserved for the
in-progress compressor.
Trait Implementations§
impl Copy for Error
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()