pub enum Error {
Unknown,
Io {
source: Error,
},
Eof,
Syntax(usize, &'static str),
UnknownType(usize, u8),
InvalidString {
pos: usize,
source: FromUtf8Error,
},
UnsupportedType(usize, &'static str),
}Expand description
Representation of a TPK read error.
Variants§
Unknown
An unknown error happened.
This error is “technical unknown”, it should only be used in cases where the user is not supposed to get an error but gets one anyway. For example, this error should never be thrown for a problem with a TPK file. More simply put, this error being returned anywhere should be considered a bug or a feature that is not yet implemented.
Io
A I/O error happened.
Eof
The end of file has been reached.
Note that this error can be considered normal behavior,
Syntax(usize, &'static str)
A syntax error happened.
This error happens when the TPK payload that is being read is corrupted or invalid.
UnknownType(usize, u8)
A type is unknown.
This error happens when the TPK payload that is being read is lexically valid, but an unknown type byte has been encountered.
InvalidString
A UTF-8 string is invalid.
This error happens when the TPK payload that is being read contains an invalid UTF-8 character at a place where it should be expected.
UnsupportedType(usize, &'static str)
A type is unsupported.
This error happens when the TPK payload that is being read is both lexically and semantically valid, but an unsupported type byte has been encountered.
Note that the mere existence of this error makes this crate non-TPK-compliant, and as such this error case should be expected to be removed in the near future.