Enum der::ErrorKind[][src]

#[non_exhaustive]
pub enum ErrorKind {
Show variants Failed, Length { tag: Tag, }, Noncanonical, MalformedOid, Overflow, Overlength, TrailingData { decoded: Length, remaining: Length, }, Truncated, Underlength { expected: Length, actual: Length, }, UnexpectedTag { expected: Option<Tag>, actual: Tag, }, UnknownOid { oid: ObjectIdentifier, }, UnknownTag { byte: u8, }, Utf8(Utf8Error), Value { tag: Tag, },
}
Expand description

Error type.

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.
Failed
Expand description

This error indicates a previous DER parsing operation resulted in an error and tainted the state of a Decoder or Encoder.

Once this occurs, the overall operation has failed and cannot be subsequently resumed.

Length
Expand description

Incorrect length for a given field.

Show fields

Fields of Length

tag: Tag
Expand description

Tag type of the value being decoded.

Noncanonical
Expand description

Message is not canonically encoded.

MalformedOid
Expand description

Malformed OID

Overflow
Expand description

Integer overflow occurred (library bug!).

Overlength
Expand description

Message is longer than this library’s internal limits support.

TrailingData
Expand description

Undecoded trailing data at end of message.

Show fields

Fields of TrailingData

decoded: Length
Expand description

Length of the decoded data.

remaining: Length
Expand description

Total length of the remaining data left in the buffer.

Truncated
Expand description

Unexpected end-of-message/nested field when decoding.

Underlength
Expand description

Encoded message is shorter than the expected length.

(i.e. an Encodable impl on a particular type has a buggy encoded_len)

Show fields

Fields of Underlength

expected: Length
Expand description

Expected length

actual: Length
Expand description

Actual length

UnexpectedTag
Expand description

Unexpected tag.

Show fields

Fields of UnexpectedTag

expected: Option<Tag>
Expand description

Tag the decoder was expecting (if there is a single such tag).

None if multiple tags are expected/allowed, but the actual tag does not match any of them.

actual: Tag
Expand description

Actual tag encountered in the message.

UnknownOid
This is supported on crate feature oid only.
Expand description

Unknown OID.

This error is intended to be used by libraries which parse DER-based formats which encounter unknown or unsupported OID libraries.

It enables passing back the OID value to the caller, which allows them to determine which OID(s) are causing the error (and then potentially contribute upstream support for algorithms they care about).

Show fields

Fields of UnknownOid

oid: ObjectIdentifier
Expand description

OID value that was unrecognized by a parser for a DER-based format.

UnknownTag
Expand description

Unknown/unsupported tag.

Show fields

Fields of UnknownTag

byte: u8
Expand description

Raw byte value of the tag.

Utf8(Utf8Error)
Expand description

UTF-8 errors.

Value
Expand description

Unexpected value.

Show fields

Fields of Value

tag: Tag
Expand description

Tag of the unexpected value.

Implementations

impl ErrorKind[src]

pub fn at(self, position: Length) -> Error[src]

Annotate an ErrorKind with context about where it occurred, returning an error.

Trait Implementations

impl Clone for ErrorKind[src]

fn clone(&self) -> ErrorKind[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ErrorKind[src]

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

Formats the value using the given formatter. Read more

impl Display for ErrorKind[src]

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

Formats the value using the given formatter. Read more

impl Error for ErrorKind[src]

fn source(&self) -> Option<&(dyn Error + 'static)>1.30.0[src]

The lower-level source of this error, if any. Read more

fn backtrace(&self) -> Option<&Backtrace>[src]

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

fn description(&self) -> &str1.0.0[src]

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

fn cause(&self) -> Option<&dyn Error>1.0.0[src]

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

impl From<ErrorKind> for Error[src]

fn from(kind: ErrorKind) -> Error[src]

Performs the conversion.

impl PartialEq<ErrorKind> for ErrorKind[src]

fn eq(&self, other: &ErrorKind) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ErrorKind) -> bool[src]

This method tests for !=.

impl Copy for ErrorKind[src]

impl Eq for ErrorKind[src]

impl StructuralEq for ErrorKind[src]

impl StructuralPartialEq for ErrorKind[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.