Enum ErrorKind
#[non_exhaustive]
pub enum ErrorKind
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
-
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 { original: Span } A flag was used twice, e.g.,
i-i.-
FlagRepeatedNegation { original: Span } The negation operator was used twice, e.g.,
-i-s.-
FlagUnexpectedEof Expected a flag but got EOF, e.g.,
(?.-
FlagUnrecognized Unrecognized flag, e.g.,
a.-
GroupNameDuplicate { original: Span } A duplicate capture name was found.
-
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{}orx{]}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, butsomethingwas 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\bor the beginning of a special word boundary assertion.-
UnicodeClassInvalid The Unicode class is not valid. This typically occurs when a
\pis 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
impl Clone for ErrorKind
fn clone(&self) -> Self
impl Debug for ErrorKind
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for ErrorKind
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ErrorKind
impl PartialEq for ErrorKind
fn eq(&self, other: &Self) -> bool
impl StructuralPartialEq for ErrorKind
Auto Trait Implementations
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnsafeUnpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementations
impl<T> Any for ErrorKind
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ErrorKind
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ErrorKind
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ErrorKind
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ErrorKind
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ErrorKind
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for ErrorKind
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for ErrorKind
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ErrorKind
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ErrorKind
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>