pub enum Error {
CorruptedData {
message: String,
source: Option<Box<dyn Error + Sync + Send>>,
},
BufferTooSmall {
required: usize,
provided: usize,
},
InvalidLevel {
level: i32,
min: i32,
max: i32,
},
InvalidDictionary(String),
ChecksumMismatch {
expected: u32,
actual: u32,
},
UnexpectedEof {
bytes_read: usize,
},
Io(Error),
AllocationFailed {
requested_bytes: usize,
},
Algorithm {
algorithm: &'static str,
message: String,
},
InvalidState {
expected: &'static str,
actual: &'static str,
},
Unsupported(String),
}Expand description
Compression error types.
Variants§
CorruptedData
Input data is corrupted or invalid.
BufferTooSmall
Buffer too small for output.
InvalidLevel
Invalid compression level specified.
InvalidDictionary(String)
Dictionary not found or invalid.
ChecksumMismatch
Checksum verification failed.
UnexpectedEof
Unexpected end of input stream.
Io(Error)
I/O error from underlying stream.
AllocationFailed
Memory allocation failed.
Algorithm
Algorithm-specific error.
InvalidState
Stream state error.
Unsupported(String)
Unsupported feature or format.
Implementations§
Source§impl Error
impl Error
Sourcepub fn corrupted_at(message: impl Into<String>, offset: usize) -> Error
pub fn corrupted_at(message: impl Into<String>, offset: usize) -> Error
Create a corrupted data error with offset context.
Sourcepub fn buffer_too_small(required: usize, provided: usize) -> Error
pub fn buffer_too_small(required: usize, provided: usize) -> Error
Create a buffer too small error.
Sourcepub fn checksum_mismatch(expected: u32, actual: u32) -> Error
pub fn checksum_mismatch(expected: u32, actual: u32) -> Error
Create a checksum mismatch error.
Sourcepub fn unexpected_eof(bytes_read: usize) -> Error
pub fn unexpected_eof(bytes_read: usize) -> Error
Create an unexpected EOF error.
Sourcepub fn algorithm(algorithm: &'static str, message: impl Into<String>) -> Error
pub fn algorithm(algorithm: &'static str, message: impl Into<String>) -> Error
Create an algorithm-specific error.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if error is recoverable (can retry with different parameters).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more