#[non_exhaustive]pub enum Error {
TooSmall {
needed: usize,
got: usize,
},
InvalidSignature,
HeaderTooLarge {
len: usize,
max: usize,
},
Utf8(Utf8Error),
Xml(Error),
Attr(AttrError),
Ambiguous {
name: String,
count: usize,
},
IndexOutOfRange {
name: String,
index: usize,
count: usize,
},
InvalidName {
name: String,
reason: &'static str,
},
Io(Error),
Unsupported(String),
}Expand description
Errors that can occur while parsing, reading, or writing an XISF header.
use xisf_header::{Error, Header};
let mut header = Header::new();
header.append("HISTORY", "reduced with siril").unwrap();
header.append("HISTORY", "stacked 20x300s").unwrap();
assert!(matches!(
header.get_str("HISTORY"),
Err(Error::Ambiguous { count: 2, .. })
));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TooSmall
The input was shorter than required (the 16-byte preamble, or the preamble plus the declared XML-header length).
InvalidSignature
The first eight bytes were not the XISF0100 monolithic-signature.
HeaderTooLarge
The declared XML-header length exceeded the 8 MiB safety cap.
Fields
Utf8(Utf8Error)
The XML header was not valid UTF-8.
Xml(Error)
The XML header was syntactically malformed.
Attr(AttrError)
An attribute in the XML header was malformed.
Ambiguous
A singular access (get/set/remove by bare name) targeted a keyword
that appears more than once. Disambiguate with an (name, n) key, or use
get_all/count.
IndexOutOfRange
A Key::Nth (name, n) access referenced an
occurrence index that does not exist.
Fields
InvalidName
A write supplied a name that is not a valid FITS keyword (≤ 8 printable ASCII characters) or valid XISF property id.
Io(Error)
An I/O error occurred while reading or writing a file.
Unsupported(String)
Header::update_file cannot safely
splice this file’s XML: the common case is exactly one <Image location="attachment:OFFSET:SIZE"> element. Multiple attachments
(e.g. a Thumbnail alongside the Image), no attachment at all, or a
self-closing <Image/> that needs new child elements inserted are
rejected rather than risking data loss.
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()