Skip to main content

Reason

Enum Reason 

Source
#[non_exhaustive]
pub enum Reason {
Show 19 variants Truncated, UnknownProlog(u32), TooDeep, SizeOverflow, LengthTooShort(usize), DoesNotFit { kind: ObjectType, size: usize, left: usize, }, DirectoryOffset, RealTooShort, NotBcd { kind: ObjectType, hex: String, }, BadSign(u8), EmptyInteger, LengthTooSmall(ObjectType), OddString, UnitWithoutReal, ArrayDimensions(usize), ArrayLength, TooManyObjects, TooManyNibbles, TooManyCloned,
}
Expand description

Why the nibbles at DecodeError::offset are not an object.

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

Truncated

The object runs past the end of the nibbles: a field starts or ends beyond them.

§

UnknownProlog(u32)

The 5-nibble prolog is in the prolog range but is no known type.

§

TooDeep

Objects nest deeper than MAX_DEPTH levels.

§

SizeOverflow

A size or position does not fit a usize.

§

LengthTooShort(usize)

A length field holds less than its own 5 nibbles.

§

DoesNotFit

The object’s fields say it is size nibbles long, but only left nibbles follow its start.

Fields

§kind: ObjectType

Its type.

§size: usize

Its size from its fields.

§left: usize

Nibbles from its start to the end of the input.

§

DirectoryOffset

A directory’s last-variable offset matches none of its records.

§

RealTooShort

A real’s body is shorter than 16 nibbles.

§

NotBcd

A real’s or an integer’s body holds a nibble above 9; the body as hex.

Fields

§hex: String

The body, hex.

§

BadSign(u8)

A real’s sign nibble is neither 0 nor 9.

§

EmptyInteger

An integer without a single nibble.

§

LengthTooSmall(ObjectType)

A string’s, binary integer’s or integer’s length field is below 5.

§

OddString

A string of an odd number of nibbles.

§

UnitWithoutReal

A unit object whose first element is no real.

§

ArrayDimensions(usize)

An array of more dimensions than the calculator makes (2).

§

ArrayLength

An array whose dimensions do not match its length.

§

TooManyObjects

More objects than crate::MAX_DECODED_OBJECTS in one decode.

§

TooManyNibbles

More nibbles read than crate::MAX_DECODED_NIBBLES in one decode.

§

TooManyCloned

More nibbles cloned than crate::MAX_CLONED_NIBBLES in one decode.

Trait Implementations§

Source§

impl Clone for Reason

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 Reason

Source§

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

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

impl Eq for Reason

Source§

impl PartialEq for Reason

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Reason

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