pub enum ParseHeaderError {
MagicString,
Version {
major: u8,
minor: u8,
},
HeaderLengthOverflow(u32),
NonAscii,
Utf8Parse(Utf8Error),
UnknownKey(Value),
MissingKey(String),
IllegalValue {
key: String,
value: Value,
},
DictParse(ParseError),
MetaNotDict(Value),
MissingNewline,
}Expand description
Error parsing an .npy header.
Variants§
MagicString
The first several bytes are not the expected magic string.
Version
The version number specified in the header is unsupported.
HeaderLengthOverflow(u32)
The HEADER_LEN doesn’t fit in usize.
NonAscii
The array format string contains non-ASCII characters.
This is an error for .npy format versions 1.0 and 2.0.
Utf8Parse(Utf8Error)
Error parsing the array format string as UTF-8.
This does not apply to .npy format versions 1.0 and 2.0, which require the array format string to be ASCII.
UnknownKey(Value)
The Python dictionary in the header contains an unexpected key.
MissingKey(String)
The Python dictionary in the header is missing an expected key.
IllegalValue
The value corresponding to an expected key is illegal (e.g., the wrong type).
DictParse(ParseError)
Error parsing the dictionary in the header.
MetaNotDict(Value)
The metadata in the header is not a dictionary.
MissingNewline
There is no newline at the end of the header.