#[non_exhaustive]pub enum Error {
Show 20 variants
Io {
format: Format,
path: PathBuf,
source: Error,
},
UnexpectedEof {
format: Format,
offset: usize,
needed: usize,
available: usize,
},
InvalidMagic {
format: Format,
found: Vec<u8>,
},
UnsupportedVariant {
format: Format,
found: Vec<u8>,
},
UnsupportedVersion {
format: Format,
found: Vec<u8>,
},
OddUtf16ByteLength {
format: Format,
field: &'static str,
offset: usize,
length: usize,
},
InvalidUtf16 {
format: Format,
field: &'static str,
offset: usize,
source: DecodeUtf16Error,
},
InvalidUtf8 {
format: Format,
field: &'static str,
offset: usize,
source: Utf8Error,
},
InvalidAscii {
format: Format,
field: &'static str,
offset: usize,
byte: u8,
},
InvalidCompression {
format: Format,
offset: usize,
status: i32,
},
InvalidOffset {
format: Format,
field: &'static str,
offset: usize,
minimum: usize,
maximum: usize,
},
SizeMismatch {
format: Format,
field: &'static str,
expected: u64,
actual: u64,
},
AllocationFailed {
format: Format,
field: &'static str,
requested: usize,
source: TryReserveError,
},
InvalidCount {
format: Format,
field: &'static str,
count: u64,
maximum: u64,
},
DuplicateCodeIndex {
format: Format,
index: u64,
},
InvalidCodeIndex {
format: Format,
index: u64,
offset: usize,
},
InvalidCodeComponent {
format: Format,
field: &'static str,
index: u64,
offset: usize,
},
InvalidRecordHeader {
format: Format,
field: &'static str,
offset: usize,
found: Vec<u8>,
},
InvalidExtensionLength {
format: Format,
field: &'static str,
offset: usize,
length: usize,
minimum: usize,
},
CountMismatch {
format: Format,
field: &'static str,
expected: u64,
actual: u64,
},
}Expand description
Errors returned while reading or parsing a dictionary.
Every variant retains the source format and structured diagnostic data so callers can distinguish malformed input, unsupported data, and I/O errors without inspecting the displayed error message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
A dictionary file could not be read.
Fields
UnexpectedEof
A read extended past the available input.
Fields
InvalidMagic
The dictionary magic bytes were invalid.
UnsupportedVariant
The container variant was not supported.
Fields
UnsupportedVersion
The format version was not supported.
Fields
OddUtf16ByteLength
A UTF-16LE field declared an odd number of bytes.
Fields
InvalidUtf16
A field contained invalid UTF-16.
Fields
source: DecodeUtf16ErrorUnderlying UTF-16 decoder error.
InvalidUtf8
A field contained invalid UTF-8.
Fields
InvalidAscii
A field declared as ASCII contained a non-ASCII byte.
Fields
InvalidCompression
A compressed data section could not be decoded.
Fields
InvalidOffset
A declared byte offset was outside its valid section.
Fields
SizeMismatch
A decoded section size disagreed with the source declaration.
Fields
AllocationFailed
Memory for a declared section could not be reserved.
Fields
source: TryReserveErrorUnderlying allocation error.
InvalidCount
A declared count cannot fit in the remaining input.
Fields
DuplicateCodeIndex
A code table contains the same identifier more than once.
InvalidCodeIndex
A dictionary entry refers to an identifier absent from its code table.
Fields
InvalidCodeComponent
A component of an encoded syllable was outside its lookup table.
Fields
InvalidRecordHeader
A record header did not match any supported layout.
Fields
InvalidExtensionLength
A record field is shorter than the format requires.
Fields
CountMismatch
A parsed item count disagrees with its declared count.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()