ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind {
Show 37 variants MissingRepetition, UnfinishedRepetition, EmptyDecimal, InvalidDecimal, EmptyHex, InvalidHex, NonUnicodeHex, InvalidRepetitionRange, UnfinishedEscape, UnsupportedBackref, UnsupportedEscape, UnfinishedWordBoundary, UnknownWordBoundary, UnicodeClassesNotSupported, LookaroundNotSupported, UnfinishedCaptureName, EmptyCaptureName, InvalidCaptureName, NonAsciiCaptureName, DuplicateCaptureName { prev_pos: Range<usize>, }, UnfinishedGroup, NonMatchingGroupEnd, UnfinishedSet, InvalidRangeStart, InvalidRangeEnd, InvalidRange, InvalidEscapeInSet, UnfinishedFlags, UnfinishedFlagsNegation, RepeatedFlagNegation, UnsupportedFlag, RepeatedFlag { contradicting: bool, }, DisallowedWhitespace, DisallowedComment, AstOverflow, GroupDepthOverflow, NamedGroupOverflow,
}
Expand description

Kind of a regex validation Error.

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

MissingRepetition

Missing node for repetition, e.g. in *.

§

UnfinishedRepetition

Unfinished repetition, e.g. in .{.

§

EmptyDecimal

Empty decimal in a counted repetition, e.g. in .{}.

§

InvalidDecimal

Invalid decimal in a counted repetition, e.g. in .{2x}.

§

EmptyHex

Empty hexadecimal escape, e.g. \x{}.

§

InvalidHex

Invalid hexadecimal escape, e.g. \u{what}.

§

NonUnicodeHex

Hexadecimal escape does not map to a Unicode char, e.g. \U99999999.

§

InvalidRepetitionRange

Invalid counted repetition range, e.g. in .{3,2}.

§

UnfinishedEscape

Unfinished escape, e.g. \u1.

§

UnsupportedBackref

Backreferences, e.g. \1, are not supported (same as in the regex crate).

§

UnsupportedEscape

Unsupported escape, e.g. \Y.

§

UnfinishedWordBoundary

Unfinished word boundary, e.g. \b{start.

§

UnknownWordBoundary

Unknown word boundary, e.g. \b{what}.

§

UnicodeClassesNotSupported

Unicode classes like \pN or \p{Digit} are not supported.

§

LookaroundNotSupported

Lookaround groups are not supported (same as in the regex crate).

§

UnfinishedCaptureName

Unfinished capture name, e.g. in (?<what.

§

EmptyCaptureName

Empty capture name, e.g. in (?P<>.).

§

InvalidCaptureName

Invalid capture name, e.g. in (?< what >.).

§

NonAsciiCaptureName

Non-ASCII chars in the capture name.

§

DuplicateCaptureName

Duplicate capture name, e.g., in (?<test>.)(?<test>.).

Fields

§prev_pos: Range<usize>

Byte range of the previous capture name definition.

§

UnfinishedGroup

Unfinished group, e.g. in (..

§

NonMatchingGroupEnd

Non-matching group end, e.g. in (.)).

§

UnfinishedSet

Unfinished set, e.g. in [0-9.

§

InvalidRangeStart

Invalid set range start, e.g. in [\d-9] (\d doesn’t correspond to a single char).

§

InvalidRangeEnd

Invalid set range end, e.g. in [0-\D] (\D doesn’t correspond to a single char).

§

InvalidRange

Invalid range, e.g., in [9-0].

§

InvalidEscapeInSet

Invalid escape encountered in a character set, e.g. in [0\b] (\b is an assertion, it doesn’t map to a char or a set of chars).

§

UnfinishedFlags

Unfinished flags, e.g., (?x.

§

UnfinishedFlagsNegation

Unfinished negation in flags, e.g. (?-).

§

RepeatedFlagNegation

Repeated negation in flags, e.g. (?--x).

§

UnsupportedFlag

Unsupported flag, e.g. in (?Y).

§

RepeatedFlag

Repeated flag, e.g. in (?xx).

Fields

§contradicting: bool

Do the flag mentions contradict each other?

§

DisallowedWhitespace

Disallowed whitespace, e.g. in \u{1 2 3}. This is technically supported by regex, but makes literals harder to read.

§

DisallowedComment

Disallowed comment, e.g.

\U{1# one!
23}

This is technically supported by regex, but makes literals harder to read.

§

AstOverflow

Regex contains too many spans for the capacity specified in RegexOptions::parse() etc.

§

GroupDepthOverflow

Regex contains too deeply nested groups.

§

NamedGroupOverflow

Regex contains too many named captures / groups.

Trait Implementations§

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, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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