Skip to main content

XtceError

Enum XtceError 

Source
#[non_exhaustive]
pub enum XtceError { Io { path: PathBuf, source: Error, }, Parse(ParseError), NotXtce { found: String, }, Missing { what: &'static str, path: String, }, Invalid { what: &'static str, value: String, path: String, reason: String, }, UnresolvedReference { kind: RefKind, reference: String, path: String, }, DuplicateDefinition { kind: RefKind, name: String, path: String, }, InheritanceCycle { chain: Vec<String>, }, Unsupported { element: String, path: String, }, ArrayNotExpanded { reason: String, path: String, }, }
Expand description

Anything that can go wrong turning an XTCE document into an crate::XtceDb.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io

The file could not be read.

Fields

§path: PathBuf

Path that could not be read.

§source: Error

Underlying I/O failure.

§

Parse(ParseError)

The document is not well-formed XML.

§

NotXtce

The document is well-formed but not an XTCE SpaceSystem.

Fields

§found: String

The root element actually present.

§

Missing

A required element or attribute is absent.

Fields

§what: &'static str

What was expected, e.g. "name attribute".

§path: String

Element path within the document.

§

Invalid

A value is present but cannot be interpreted.

Fields

§what: &'static str

What was being interpreted, e.g. "sizeInBits".

§value: String

The offending text.

§path: String

Element path within the document.

§reason: String

Why it could not be used.

§

UnresolvedReference

A name reference does not resolve to a definition.

Fields

§kind: RefKind

Which namespace was searched.

§reference: String

The reference text as written.

§path: String

Element path within the document.

§

DuplicateDefinition

Two definitions share a name in a namespace that requires uniqueness.

Fields

§kind: RefKind

Which namespace the clash is in.

§name: String

The duplicated name.

§path: String

Element path of the second definition.

§

InheritanceCycle

Container inheritance forms a cycle.

Detected during resolution rather than during decoding, so a malformed database fails at load time instead of overflowing the stack on the first packet.

Fields

§chain: Vec<String>

Container names along the cycle, in order.

§

Unsupported

An XTCE construct outside this crate’s declared scope.

This is only raised for constructs that cannot be represented. Constructs that can be represented but not decoded are recorded in the IR instead and reported by crate::XtceDb::unsupported, so loading a real mission database never fails just because part of it is out of scope.

Fields

§element: String

The element that is out of scope.

§path: String

Element path within the document.

§

ArrayNotExpanded

An array entry could not be turned into one parameter per element.

Loading fails rather than the array being dropped: an entry that does not expand leaves every field after it at the wrong offset, and a container decoded at the wrong offsets is worse than one that refuses.

Fields

§reason: String

Why the expansion could not be carried out.

§path: String

Element path within the document.

Trait Implementations§

Source§

impl Debug for XtceError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for XtceError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for XtceError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ParseError> for XtceError

Source§

fn from(source: ParseError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.