#[non_exhaustive]pub enum ParseError {
Show 13 variants
Io {
source: Error,
},
InvalidMagic,
UnknownChunkTag(ChunkTag),
UnknownSqpkCommand(u8),
ChecksumMismatch {
tag: ChunkTag,
expected: u32,
actual: u32,
},
InvalidField {
context: &'static str,
},
OversizedChunk(usize),
UnknownFileOperation(u8),
Utf8Error(FromUtf8Error),
Decompress {
source: Error,
},
Decode {
context: &'static str,
message: String,
},
NegativeFileOffset(i64),
TruncatedPatch,
}Expand description
Failures produced by the parsing layer (crate::chunk).
Surfaced by crate::ZiPatchReader::new, crate::open_patch, and
crate::ZiPatchReader::next_chunk. None of these variants involve the
filesystem of the install target — they describe shapes the parser
rejected.
#[non_exhaustive]: parse-error vocabulary grows as the parser surfaces
new structural failure modes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
I/O failure reading from the patch source.
Fields
source: ErrorUnderlying std::io::Error from the patch source.
InvalidMagic
The 12-byte ZiPatch magic header was missing or did not match.
UnknownChunkTag(ChunkTag)
A 4-byte chunk tag was not recognised by the parser.
UnknownSqpkCommand(u8)
A SQPK sub-command byte was not recognised by the parser.
ChecksumMismatch
A chunk’s recorded CRC32 did not match the computed CRC32.
Fields
InvalidField
A field value failed a parser invariant (e.g. negative size).
OversizedChunk(usize)
A chunk declared a size larger than the parser’s maximum (512 MiB).
UnknownFileOperation(u8)
A SqpkFile operation byte was not recognised.
Utf8Error(FromUtf8Error)
A UTF-8 decode failed when reading a path or name field.
Decompress
DEFLATE decompression of a SqpkCompressedBlock payload failed.
Surfaced both by the standalone
SqpkCompressedBlock::decompress_into
helper (a parse-side API on the chunk type) and propagated up through
apply when the apply layer drives block decompression.
Fields
source: ErrorUnderlying std::io::Error returned by the decompressor.
Decode
A binary decode (via the underlying binrw parser) failed.
The third-party error type is not exposed in this variant — only the field context (where parsing failed) and the formatted message (what went wrong) are surfaced. Callers should treat this as an opaque “the wire format was malformed at this field” signal.
Fields
NegativeFileOffset(i64)
A SqpkFile carried a negative file_offset that cannot be applied.
TruncatedPatch
Stream ended without an EOF_ chunk; download or copy was truncated.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()
Source§impl From<Error> for ParseError
impl From<Error> for ParseError
Source§impl From<Error> for ParseError
impl From<Error> for ParseError
Source§impl From<FromUtf8Error> for ParseError
impl From<FromUtf8Error> for ParseError
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Source§impl From<ParseError> for ApplyError
impl From<ParseError> for ApplyError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Source§impl From<ParseError> for IndexError
impl From<ParseError> for IndexError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for ParseError
impl !RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl !UnwindSafe for ParseError
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
Source§impl<T> CustomError for T
impl<T> CustomError for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more