#[non_exhaustive]
pub enum ErrorKind {
Show 24 variants DateTime, Failed, FileNotFound, Incomplete { expected_len: Length, actual_len: Length, }, Io(ErrorKind), IndefiniteLength, Length { tag: Tag, }, Noncanonical { tag: Tag, }, OidMalformed, OidUnknown { oid: ObjectIdentifier, }, SetDuplicate, SetOrdering, Overflow, Overlength, Pem(Error), PermissionDenied, Reader, TagModeUnknown, TagNumberInvalid, TagUnexpected { expected: Option<Tag>, actual: Tag, }, TagUnknown { byte: u8, }, TrailingData { decoded: Length, remaining: Length, }, Utf8(Utf8Error), Value { tag: Tag, },
}
Available on crate feature pkcs8 only.
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.
§

DateTime

Date-and-time related errors.

§

Failed

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.

§

FileNotFound

Available on crate feature std only.

File not found error.

§

Incomplete

Fields

§expected_len: Length

Expected message length.

Note that this length represents a minimum lower bound on how much additional data is needed to continue parsing the message.

It’s possible upon subsequent message parsing that the parser will discover even more data is needed.

§actual_len: Length

Actual length of the message buffer currently being processed.

Message is incomplete and does not contain all of the expected data.

§

Io(ErrorKind)

Available on crate feature std only.

I/O errors.

§

IndefiniteLength

Indefinite length disallowed.

§

Length

Fields

§tag: Tag

Tag of the value being decoded.

Incorrect length for a given field.

§

Noncanonical

Fields

§tag: Tag

Tag of the value which is not canonically encoded.

Message is not canonically encoded.

§

OidMalformed

OID is improperly encoded.

§

OidUnknown

Fields

§oid: ObjectIdentifier

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

Available on crate feature oid only.

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

§

SetDuplicate

SET cannot contain duplicates.

§

SetOrdering

SET ordering error: items not in canonical order.

§

Overflow

Integer overflow occurred (library bug!).

§

Overlength

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

§

Pem(Error)

Available on crate feature pem only.

PEM encoding errors.

§

PermissionDenied

Available on crate feature std only.

Permission denied reading file.

§

Reader

Reader does not support the requested operation.

§

TagModeUnknown

Unknown tag mode.

§

TagNumberInvalid

Invalid tag number.

The “tag number” is the lower 5-bits of a tag’s octet. This error occurs in the case that all 5-bits are set to 1, which indicates a multi-byte tag which is unsupported by this library.

§

TagUnexpected

Fields

§expected: Option<Tag>

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

Actual tag encountered in the message.

Unexpected tag.

§

TagUnknown

Fields

§byte: u8

Raw byte value of the tag.

Unknown/unsupported tag.

§

TrailingData

Fields

§decoded: Length

Length of the decoded data.

§remaining: Length

Total length of the remaining data left in the buffer.

Undecoded trailing data at end of message.

§

Utf8(Utf8Error)

UTF-8 errors.

§

Value

Fields

§tag: Tag

Tag of the unexpected value.

Unexpected value.

Implementations§

§

impl ErrorKind

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

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

Trait Implementations§

§

impl Clone for ErrorKind

§

fn clone(&self) -> ErrorKind

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for ErrorKind

§

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

Formats the value using the given formatter. Read more
§

impl Display for ErrorKind

§

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

Formats the value using the given formatter. Read more
§

impl From<ErrorKind> for Error

§

fn from(err: ErrorKind) -> Error

Converts to this type from the input type.
§

impl From<ErrorKind> for Error

§

fn from(kind: ErrorKind) -> Error

Converts to this type from the input type.
§

impl PartialEq for ErrorKind

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for ErrorKind

§

impl Eq for ErrorKind

§

impl StructuralPartialEq for ErrorKind

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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§

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

§

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

§

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.