pub enum PuzError {
InvalidMagic {
found: Vec<u8>,
},
InvalidChecksum {
expected: u16,
found: u16,
context: String,
},
InvalidDimensions {
width: u8,
height: u8,
},
InvalidClueCount {
expected: u16,
found: usize,
},
SectionSizeMismatch {
section: String,
expected: usize,
found: usize,
},
ParseError {
message: String,
position: Option<u64>,
context: String,
},
IoError {
message: String,
kind: ErrorKind,
position: Option<u64>,
},
InvalidUtf8 {
message: String,
position: Option<u64>,
},
MissingData {
field: String,
position: Option<u64>,
},
UnsupportedVersion {
version: String,
},
InvalidGrid {
reason: String,
},
InvalidClues {
reason: String,
},
}Expand description
Errors that can occur when parsing a .puz file.
These represent critical issues that prevent successful parsing of the puzzle.
Unlike PuzWarning, these errors cause parsing to fail completely.
Variants§
InvalidMagic
The file magic header is invalid
InvalidChecksum
Checksum validation failed
InvalidDimensions
Puzzle dimensions are invalid
InvalidClueCount
Clue count doesn’t match expected value
SectionSizeMismatch
Extension section size mismatch
ParseError
Parse error with position context
IoError
An I/O error occurred while reading the file
InvalidUtf8
The file contains invalid UTF-8 data
MissingData
Required data is missing from the file
UnsupportedVersion
The file version is not supported
InvalidGrid
Grid validation failed
InvalidClues
Clue processing failed
Implementations§
Source§impl PuzError
impl PuzError
Sourcepub fn with_position(self, position: u64) -> Self
pub fn with_position(self, position: u64) -> Self
Add position context to an existing error
Sourcepub fn with_context(self, context: &str) -> Self
pub fn with_context(self, context: &str) -> Self
Add context to an existing error
Trait Implementations§
Source§impl Error for PuzError
impl Error for PuzError
1.30.0 · 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()
impl StructuralPartialEq for PuzError
Auto Trait Implementations§
impl Freeze for PuzError
impl RefUnwindSafe for PuzError
impl Send for PuzError
impl Sync for PuzError
impl Unpin for PuzError
impl UnwindSafe for PuzError
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