#[non_exhaustive]
pub enum ErrorKind {
Show 15 variants
DuplicateField {
tag: Tag,
},
Failed,
Length {
tag: Tag,
},
Noncanonical {
tag: Tag,
},
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
DuplicateField
Fields
tag: Tag
Tag of the duplicated field.
Indicates a field which is duplicated when only one is expected.
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.
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.
MalformedOid
Malformed OID
Overflow
Integer overflow occurred (library bug!).
Overlength
Message is longer than this library’s internal limits support.
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.
Truncated
Unexpected end-of-message/nested field when decoding.
Underlength
Encoded message is shorter than the expected length.
(i.e. an Encodable
impl on a particular type has a buggy encoded_len
)
UnexpectedTag
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.
UnknownOid
Fields
oid: ObjectIdentifier
OID value that was unrecognized by a parser for a DER-based format.
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).
UnknownTag
Fields
byte: u8
Raw byte value of the tag.
Unknown/unsupported tag.
Utf8(Utf8Error)
UTF-8 errors.
Value
Fields
tag: Tag
Tag of the unexpected value.
Unexpected value.
Implementations
Trait Implementations
sourceimpl Error for ErrorKind
impl Error for ErrorKind
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl Copy for ErrorKind
impl Eq for ErrorKind
impl StructuralEq for ErrorKind
impl StructuralPartialEq for ErrorKind
Auto Trait Implementations
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more