Skip to main content

DecodeError

Enum DecodeError 

Source
#[non_exhaustive]
pub enum DecodeError {
Show 15 variants Bits { parameter: String, source: BitError, }, NoSuchContainer { name: String, }, AmbiguousRoot { candidates: usize, }, UnrecognizedPacket { container: String, candidates: Vec<String>, }, AmbiguousPacket { container: String, candidates: Vec<String>, }, ParameterNotYetDecoded { context: &'static str, parameter: String, }, IncomparableValue { parameter: String, value_kind: &'static str, literal: String, }, InvalidText { parameter: String, charset: &'static str, bytes: usize, }, UnterminatedString { parameter: String, bytes: usize, }, UnknownEnumeration { parameter: String, value: i128, }, Calibration { parameter: String, reason: String, }, BadFieldSize { parameter: String, bits: i64, }, NoDiscreteLookupMatch { parameter: String, }, Unsupported { element: String, context: String, }, DanglingIndex { what: &'static str, },
}
Expand description

Anything that can go wrong decoding a packet.

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.
§

Bits

A field extends past the end of the packet.

Fields

§parameter: String

Name of the parameter being decoded.

§source: BitError

The underlying bit-cursor failure.

§

NoSuchContainer

The named root container does not exist in the database.

Fields

§name: String

The name that was looked up.

§

AmbiguousRoot

The database offers no unambiguous root container and none was named.

Fields

§candidates: usize

How many containers have no base container.

§

UnrecognizedPacket

Decoding reached an abstract container whose inheritors all failed their criteria.

This is the reference implementation’s UnrecognizedPacketTypeError: the packet is of a type the definition does not describe.

Fields

§container: String

Name of the abstract container that ran out of options.

§candidates: Vec<String>

Names of the inheritors that were considered.

§

AmbiguousPacket

More than one inheritor matched, so the packet type is ambiguous.

Fields

§container: String

Name of the container being specialised.

§candidates: Vec<String>

Names of the inheritors that matched.

§

ParameterNotYetDecoded

A criterion or dynamic size referenced a parameter that has not been decoded yet.

XTCE references are positional: a field can only depend on a field that precedes it.

Fields

§context: &'static str

Where the reference appeared.

§parameter: String

The parameter that was referenced.

§

IncomparableValue

A comparison’s literal cannot be interpreted as the type of the value it is compared against.

Fields

§parameter: String

Name of the referenced parameter.

§value_kind: &'static str

What kind of value it held.

§literal: String

The literal as written in the definition.

§

InvalidText

The bytes are not valid text in the declared character set.

Fields

§parameter: String

Name of the parameter being decoded.

§charset: &'static str

Character set that was expected.

§bytes: usize

Length of the offending buffer.

§

UnterminatedString

A string declares a termination character that does not occur in its buffer.

Fields

§parameter: String

Name of the parameter being decoded.

§bytes: usize

Length of the buffer that was searched.

§

UnknownEnumeration

A raw value is outside an enumeration’s defined values.

Fields

§parameter: String

Name of the parameter being decoded.

§value: i128

The raw value that was looked up.

§

Calibration

A calibrator rejected its input.

Fields

§parameter: String

Name of the parameter being decoded.

§reason: String

Why calibration failed.

§

BadFieldSize

A dynamic size resolved to something unusable.

Fields

§parameter: String

Name of the parameter being decoded.

§bits: i64

The size that was computed.

§

NoDiscreteLookupMatch

A DiscreteLookupList had no matching entry.

Fields

§parameter: String

Name of the parameter being decoded.

§

Unsupported

The definition uses a construct this crate models but cannot decode.

This is the promise SUPPORTED.md makes: out-of-scope constructs load without complaint and fail here, at the exact point a value depends on them.

Fields

§element: String

The element that is out of scope.

§context: String

What was being decoded when it was reached.

§

DanglingIndex

The database is internally inconsistent — an index does not resolve.

Fields

§what: &'static str

Which kind of index.

Trait Implementations§

Source§

impl Clone for DecodeError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecodeError

Source§

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

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

impl Display for DecodeError

Source§

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

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

impl Error for DecodeError

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.