DecodeError

Enum DecodeError 

Source
pub enum DecodeError {
    SuddenEnd {
        actual_length: usize,
        expected_length: usize,
    },
    TypeEndsTooEarly {
        remaining_no_of_bytes: isize,
    },
    InvalidBoolean {
        found_integer: i32,
        at_position: usize,
    },
    VarOpaqueExceedsMaxLength {
        at_position: usize,
        max_length: i32,
        actual_length: i32,
    },
    StringExceedsMaxLength {
        at_position: usize,
        max_length: i32,
        actual_length: i32,
    },
    VarArrayExceedsMaxLength {
        at_position: usize,
        max_length: i32,
        actual_length: i32,
    },
    InvalidOptional {
        at_position: usize,
        has_code: u32,
    },
    InvalidEnumDiscriminator {
        at_position: usize,
    },
    InvalidBase64,
}
Expand description

An error type for decoding XDR data

Variants§

§

SuddenEnd

The XDR data ends too early.

The decoder expects more bytes to decode the data successfully The actual length and the expected length are given by actual_length and expected_length

Fields

§actual_length: usize
§expected_length: usize
§

TypeEndsTooEarly

There binary data is longer than expected

The XDR is self delimiting and would end earlier than the length of the provided binary data. The number of remaining bytes is given by remaining_no_of_bytes

Fields

§remaining_no_of_bytes: isize
§

InvalidBoolean

The XDR contains an invalid boolean

The boolean is neither encoded as 0 or 1. The value found is given by found_integer.

Fields

§found_integer: i32
§at_position: usize
§

VarOpaqueExceedsMaxLength

The XDR contains a “Var Opaque” whose length exceeds the specified maximal length

Fields

§at_position: usize
§max_length: i32
§actual_length: i32
§

StringExceedsMaxLength

The XDR contains a string whose length exceeds the specified maximal length

Fields

§at_position: usize
§max_length: i32
§actual_length: i32
§

VarArrayExceedsMaxLength

The XDR contains a “Var Array” whose length exceeds the specified maximal length

Fields

§at_position: usize
§max_length: i32
§actual_length: i32
§

InvalidOptional

The XDR contains an in invalid “Optional”

The “optional” is neither encoded as 0 or 1. The value found is given by has_code.

Fields

§at_position: usize
§has_code: u32
§

InvalidEnumDiscriminator

The XDR contains an enum with an invalid discriminator

The discriminator does not have one of the allowed values

Fields

§at_position: usize
§

InvalidBase64

The base64 encoding of the binary XDR is invalid

Trait Implementations§

Source§

impl Debug for DecodeError

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.