# [−] [src] Enum regex_syntax::ast::ErrorKind

    pub enum ErrorKind {
        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,
        UnsupportedBackreference,
        UnsupportedLookAround,
        // some variants omitted
    }

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

## 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 of FlagDuplicate

`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 of FlagRepeatedNegation

`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 of GroupNameDuplicate

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

`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 PartialEq<ErrorKind> for ErrorKind` [src]

#### `fn eq(&self, other: &ErrorKind) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &ErrorKind) -> bool` [src]

This method tests for `!=`.

### `impl Clone for ErrorKind` [src]

#### `fn clone(&self) -> ErrorKind` [src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0 [src]

Performs copy-assignment from `source`. Read more

### `impl Eq for ErrorKind` [src]

### `impl Display for ErrorKind` [src]

#### `fn fmt(&self, f: &mut Formatter) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl Debug for ErrorKind` [src]

#### `fn fmt(&self, f: &mut Formatter) -> Result` [src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

### `impl Send for ErrorKind`

### `impl Sync for ErrorKind`

## Blanket Implementations

### `impl<T> From<T> for T` [src]

#### `fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T` [src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `default fn to_string(&self) -> String` [src]

Converts the given value to a `String`. Read more

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)