#[non_exhaustive]pub enum DecodeErrorKind {
Show 38 variants
PermittedAlphabetError {
reason: PermittedAlphabetError,
},
SizeConstraintNotSatisfied {
size: Option<usize>,
expected: String,
},
ValueConstraintNotSatisfied {
value: BigInt,
expected: Bounded<i128>,
},
InnerSubtypeConstraintNotSatisfied {
reason: InnerSubtypeConstraintError,
},
CodecSpecific {
inner: CodecDecodeError,
},
EnumerationIndexNotFound {
index: usize,
extended_list: bool,
},
ChoiceIndexNotFound {
index: usize,
variants: Variants,
},
ChoiceIndexExceedsPlatformWidth {
needed: u32,
present: DecodeError,
},
Custom {
msg: String,
},
DiscriminantValueNotFound {
discriminant: isize,
},
DuplicateField {
name: &'static str,
},
ExceedsMaxLength {
length: BigUint,
},
LengthExceedsPlatformWidth {
msg: String,
},
FieldError {
name: &'static str,
nested: Box<DecodeError>,
},
Incomplete {
needed: Needed,
},
Eof,
IncorrectItemNumberInSequence {
expected: usize,
actual: usize,
},
IntegerOverflow {
max_width: u32,
},
IntegerTypeConversionFailed {
msg: String,
},
InvalidRealEncoding,
RealNotSupported,
InvalidBitString {
bits: u8,
},
InvalidBool {
value: u8,
},
ZeroLengthOfLength,
MismatchedLength {
expected: usize,
actual: usize,
},
MissingField {
name: &'static str,
},
MissingTagClassOrValueInSequenceOrSet {
class: Class,
value: u32,
},
RangeExceedsPlatformWidth {
needed: u32,
present: u32,
},
RequiredExtensionNotPresent {
tag: Tag,
},
Parser {
msg: String,
},
StringConversionFailed {
tag: Tag,
msg: String,
},
FixedStringConversionFailed {
tag: Tag,
expected: usize,
actual: usize,
},
NoValidChoice {
name: &'static str,
},
TypeNotExtensible,
UnexpectedExtraData {
length: usize,
},
UnknownField {
index: usize,
tag: Tag,
},
UnexpectedEmptyInput,
ExceedsMaxParseDepth,
}Expand description
DecodeError kinds which are common for all codecs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PermittedAlphabetError
Permitted alphabet constraint wasn’t satisfied.
Fields
reason: PermittedAlphabetErrorThe reason the constraint wasn’t satisfied.
SizeConstraintNotSatisfied
Size constraint wasn’t satisfied.
ValueConstraintNotSatisfied
Value constraint wasn’t satisfied.
Fields
InnerSubtypeConstraintNotSatisfied
Inner subtype constraint not satisfied.
Fields
reason: InnerSubtypeConstraintErrorThe reason the constraint wasn’t satisfied.
CodecSpecific
Codec specific error.
Fields
inner: CodecDecodeErrorThe inner error type.
EnumerationIndexNotFound
Enumeration index didn’t match any variant.
Fields
ChoiceIndexNotFound
Choice index didn’t match any variant.
Fields
ChoiceIndexExceedsPlatformWidth
Choice index exceeds maximum possible address width.
Custom
Uncategorised error.
DiscriminantValueNotFound
Discriminant index didn’t match any variant.
DuplicateField
Duplicate fields found.
ExceedsMaxLength
Exceeds maxmium allowed length.
LengthExceedsPlatformWidth
More than usize::MAX number of data requested.
FieldError
An error when decoding a field in a constructed type.
Incomplete
Input is provided as BIT slice for nom in UPER/APER.
On BER/CER/DER/OER/COER it is a BYTE slice.
Hence, needed field can describe either bits or bytes depending on the codec.
Eof
Encountered EOF when decoding.
IncorrectItemNumberInSequence
Invalid item number in sequence.
IntegerOverflow
Integer conversion overflow.
IntegerTypeConversionFailed
Integer conversion failure.
InvalidRealEncoding
Real conversion failure.
RealNotSupported
Decoder doesn’t support REAL
InvalidBitString
BitString contains an invalid amount of unused bits.
InvalidBool
BOOL value is not 0 or 0xFF.
ZeroLengthOfLength
Length of Length cannot be zero.
MismatchedLength
The length does not match what was expected.
MissingField
Missing field in a sequence.
MissingTagClassOrValueInSequenceOrSet
When there is a mismatch between the expected and actual tag class or value.
RangeExceedsPlatformWidth
The range of the integer exceeds the platform width.
RequiredExtensionNotPresent
A specific required extension not present.
Parser
General error when parsing data.
StringConversionFailed
General error for failed ASN.1 string conversion from bytes.
FixedStringConversionFailed
General error for failed ASN.1 fixed-sized string conversion from bytes.
NoValidChoice
An error when the choice cannot be created from the given variant.
TypeNotExtensible
An error when the type is not extensible when it should.
UnexpectedExtraData
Unexpected extra data found.
UnknownField
An error when a unknown field is found when decoding sequence.
UnexpectedEmptyInput
An error when there should be more data but it is not present.
ExceedsMaxParseDepth
An error when the decoder exceeds maximum allowed parse depth.
Trait Implementations§
Source§impl Debug for DecodeErrorKind
impl Debug for DecodeErrorKind
Source§impl Display for DecodeErrorKind
impl Display for DecodeErrorKind
Source§impl Error for DecodeErrorKind
impl Error for DecodeErrorKind
Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
replaced by Error::source, which can support downcasting
Source§impl ErrorCompat for DecodeErrorKind
impl ErrorCompat for DecodeErrorKind
Source§fn iter_chain(&self) -> ChainCompat<'_, '_> ⓘwhere
Self: AsErrorSource,
fn iter_chain(&self) -> ChainCompat<'_, '_> ⓘwhere
Self: AsErrorSource,
Error::source. Read moreAuto Trait Implementations§
impl Freeze for DecodeErrorKind
impl RefUnwindSafe for DecodeErrorKind
impl Send for DecodeErrorKind
impl Sync for DecodeErrorKind
impl Unpin for DecodeErrorKind
impl UnsafeUnpin for DecodeErrorKind
impl UnwindSafe for DecodeErrorKind
Blanket Implementations§
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.