Enum der_parser::error::Error

source ·
pub enum Error {
Show 21 variants BerTypeError, BerValueError, InvalidLength, InvalidValue { tag: Tag, msg: String, }, InvalidTag, UnknownTag(u32), UnexpectedTag { expected: Option<Tag>, actual: Tag, }, UnexpectedClass { expected: Option<Class>, actual: Class, }, IndefiniteLengthUnexpected, ConstructExpected, ConstructUnexpected, IntegerTooLarge, IntegerNegative, BerMaxDepth, StringInvalidCharset, InvalidDateTime, DerConstraintFailed(DerConstraint), LifetimeError, Unsupported, Incomplete(Needed), NomError(ErrorKind),
}
Expand description

The error type for operations of the FromBer, FromDer, and associated traits.

Variants§

§

BerTypeError

BER object does not have the expected type

§

BerValueError

BER object does not have the expected value

§

InvalidLength

Invalid Length

§

InvalidValue

Fields

§tag: Tag

Invalid Value when parsing object with tag {tag:?} {msg:}

§

InvalidTag

Invalid Tag

§

UnknownTag(u32)

Unknown tag: {0:?}

§

UnexpectedTag

Fields

§expected: Option<Tag>
§actual: Tag

Unexpected Tag (expected: {expected:?}, actual: {actual:?})

§

UnexpectedClass

Fields

§expected: Option<Class>
§actual: Class

Unexpected Class (expected: {expected:?}, actual: {actual:?})

§

IndefiniteLengthUnexpected

Indefinite length not allowed

§

ConstructExpected

DER object was expected to be constructed (and found to be primitive)

§

ConstructUnexpected

DER object was expected to be primitive (and found to be constructed)

§

IntegerTooLarge

Integer too large to fit requested type

§

IntegerNegative

BER integer is negative, while an unsigned integer was requested

§

BerMaxDepth

BER recursive parsing reached maximum depth

§

StringInvalidCharset

Invalid encoding or forbidden characters in string

§

InvalidDateTime

Invalid Date or Time

§

DerConstraintFailed(DerConstraint)

DER Failed constraint

§

LifetimeError

Requesting borrowed data from a temporary object

§

Unsupported

Feature is not yet implemented

§

Incomplete(Needed)

incomplete data, missing: {0:?}

§

NomError(ErrorKind)

nom error: {0:?}

Implementations§

source§

impl Error

source

pub const fn invalid_value(tag: Tag, msg: String) -> Error

Build an error from the provided invalid value

source

pub const fn unexpected_class(expected: Option<Class>, actual: Class) -> Error

Build an error from the provided unexpected class

source

pub const fn unexpected_tag(expected: Option<Tag>, actual: Tag) -> Error

Build an error from the provided unexpected tag

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

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
source§

impl Debug for Error

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

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

Formats the value using the given formatter. Read more
source§

impl Error for Error

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

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

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Err<Error>> for Error

source§

fn from(e: Err<Error>) -> Error

Converts to this type from the input type.
source§

impl From<FromUtf16Error> for Error

source§

fn from(_: FromUtf16Error) -> Error

Converts to this type from the input type.
source§

impl From<FromUtf8Error> for Error

source§

fn from(_: FromUtf8Error) -> Error

Converts to this type from the input type.
source§

impl From<Utf8Error> for Error

source§

fn from(_: Utf8Error) -> Error

Converts to this type from the input type.
source§

impl<I, E> FromExternalError<I, E> for Error

source§

fn from_external_error(_input: I, kind: ErrorKind, _e: E) -> Error

Creates a new error from an input position, an ErrorKind indicating the wrapping parser, and an external error
source§

impl<'a> ParseError<&'a [u8]> for Error

source§

fn from_error_kind(_input: &'a [u8], kind: ErrorKind) -> Error

Creates an error from the input position and an ErrorKind
source§

fn append(_input: &'a [u8], kind: ErrorKind, _other: Error) -> Error

Combines an existing error with a new one created from the input position and an ErrorKind. This is useful when backtracking through a parse tree, accumulating error context on the way
source§

fn from_char(input: I, _: char) -> Self

Creates an error from an input position and an expected character
source§

fn or(self, other: Self) -> Self

Combines two existing errors. This function is used to compare errors generated in various branches of alt.
source§

impl PartialEq for Error

source§

fn eq(&self, other: &Error) -> 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.
source§

impl Eq for Error

source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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