ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind {
Show 34 variants CaptureLimitExceeded, ClassEscapeInvalid, ClassRangeInvalid, ClassRangeLiteral, ClassUnclosed, DecimalEmpty, DecimalInvalid, EscapeHexEmpty, EscapeHexInvalid, EscapeHexInvalidDigit, EscapeUnexpectedEof, EscapeUnrecognized, FlagDanglingNegation, FlagDuplicate { original: Span, }, FlagRepeatedNegation { original: Span, }, FlagUnexpectedEof, FlagUnrecognized, GroupNameDuplicate { original: Span, }, GroupNameEmpty, GroupNameInvalid, GroupNameUnexpectedEof, GroupUnclosed, GroupUnopened, NestLimitExceeded(u32), RepetitionCountInvalid, RepetitionCountDecimalEmpty, RepetitionCountUnclosed, RepetitionMissing, SpecialWordBoundaryUnclosed, SpecialWordBoundaryUnrecognized, SpecialWordOrRepetitionUnexpectedEof, UnicodeClassInvalid, UnsupportedBackreference, UnsupportedLookAround,
}
Expand description

The type of an error that occurred while building an AST.

This error type is marked as non_exhaustive. This means that adding a new variant is not considered a breaking change.

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

CaptureLimitExceeded

The capturing group limit was exceeded.

Note that this represents a limit on the total number of capturing groups in a regex and not necessarily the number of nested capturing groups. That is, the nest limit can be low and it is still possible for this error to occur.

ยง

ClassEscapeInvalid

An invalid escape sequence was found in a character class set.

ยง

ClassRangeInvalid

An invalid character class range was found. An invalid range is any range where the start is greater than the end.

ยง

ClassRangeLiteral

An invalid range boundary was found in a character class. Range boundaries must be a single literal codepoint, but this error indicates that something else was found, such as a nested class.

ยง

ClassUnclosed

An opening [ was found with no corresponding closing ].

ยง

DecimalEmpty

Note that this error variant is no longer used. Namely, a decimal number can only appear as a repetition quantifier. When the number in a repetition quantifier is empty, then it gets its own specialized error, RepetitionCountDecimalEmpty.

ยง

DecimalInvalid

An invalid decimal number was given where one was expected.

ยง

EscapeHexEmpty

A bracketed hex literal was empty.

ยง

EscapeHexInvalid

A bracketed hex literal did not correspond to a Unicode scalar value.

ยง

EscapeHexInvalidDigit

An invalid hexadecimal digit was found.

ยง

EscapeUnexpectedEof

EOF was found before an escape sequence was completed.

ยง

EscapeUnrecognized

An unrecognized escape sequence.

ยง

FlagDanglingNegation

A dangling negation was used when setting flags, e.g., i-.

ยง

FlagDuplicate

A flag was used twice, e.g., i-i.

Fields

ยงoriginal: Span

The position of the original flag. The error position points to the duplicate flag.

ยง

FlagRepeatedNegation

The negation operator was used twice, e.g., -i-s.

Fields

ยงoriginal: Span

The position of the original negation operator. The error position points to the duplicate negation operator.

ยง

FlagUnexpectedEof

Expected a flag but got EOF, e.g., (?.

ยง

FlagUnrecognized

Unrecognized flag, e.g., a.

ยง

GroupNameDuplicate

A duplicate capture name was found.

Fields

ยงoriginal: Span

The position of the initial occurrence of the capture name. The error position itself points to the duplicate occurrence.

ยง

GroupNameEmpty

A capture group name is empty, e.g., (?P<>abc).

ยง

GroupNameInvalid

An invalid character was seen for a capture group name. This includes errors where the first character is a digit (even though subsequent characters are allowed to be digits).

ยง

GroupNameUnexpectedEof

A closing > could not be found for a capture group name.

ยง

GroupUnclosed

An unclosed group, e.g., (ab.

The span of this error corresponds to the unclosed parenthesis.

ยง

GroupUnopened

An unopened group, e.g., ab).

ยง

NestLimitExceeded(u32)

The nest limit was exceeded. The limit stored here is the limit configured in the parser.

ยง

RepetitionCountInvalid

The range provided in a counted repetition operator is invalid. The range is invalid if the start is greater than the end.

ยง

RepetitionCountDecimalEmpty

An opening { was not followed by a valid decimal value. For example, x{} or x{]} would fail.

ยง

RepetitionCountUnclosed

An opening { was found with no corresponding closing }.

ยง

RepetitionMissing

A repetition operator was applied to a missing sub-expression. This occurs, for example, in the regex consisting of just a * or even (?i)*. It is, however, possible to create a repetition operating on an empty sub-expression. For example, ()* is still considered valid.

ยง

SpecialWordBoundaryUnclosed

The special word boundary syntax, \b{something}, was used, but either EOF without } was seen, or an invalid character in the braces was seen.

ยง

SpecialWordBoundaryUnrecognized

The special word boundary syntax, \b{something}, was used, but something was not recognized as a valid word boundary kind.

ยง

SpecialWordOrRepetitionUnexpectedEof

The syntax \b{ was observed, but afterwards the end of the pattern was observed without being able to tell whether it was meant to be a bounded repetition on the \b or the beginning of a special word boundary assertion.

ยง

UnicodeClassInvalid

The Unicode class is not valid. This typically occurs when a \p is followed by something other than a {.

ยง

UnsupportedBackreference

When octal support is disabled, this error is produced when an octal escape is used. The octal escape is assumed to be an invocation of a backreference, which is the common case.

ยง

UnsupportedLookAround

When syntax similar to PCREโ€™s look-around is used, this error is returned. Some example syntaxes that are rejected include, but are not necessarily limited to, (?=re), (?!re), (?<=re) and (?<!re). Note that all of these syntaxes are otherwise invalid; this error is used to improve the user experience.

Trait Implementationsยง

Sourceยง

impl<'arbitrary> Arbitrary<'arbitrary> for ErrorKind

Sourceยง

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Sourceยง

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Sourceยง

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Sourceยง

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Sourceยง

impl Clone for ErrorKind

Sourceยง

fn clone(&self) -> ErrorKind

Returns a duplicate 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 ErrorKind

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Display for ErrorKind

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl PartialEq for ErrorKind

Sourceยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl Eq for ErrorKind

Sourceยง

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Sourceยง

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ยง

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

Sourceยง

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

Sourceยง

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.