Enum MatchErrorKind

#[non_exhaustive]
pub enum MatchErrorKind

The underlying kind of a MatchError.

This is a non-exhaustive enum. That means new variants may be added in a semver-compatible release.

Variants

Quit { byte: u8, offset: usize }

The search saw a "quit" byte at which it was instructed to stop searching.

GaveUp { offset: usize }

The search, based on heuristics, determined that it would be better to stop, typically to provide the caller an opportunity to use an alternative regex engine.

Currently, the only way for this to occur is via the lazy DFA and only when it is configured to do so (it will not return this error by default).

HaystackTooLong { len: usize }

This error occurs if the haystack given to the regex engine was too long to be searched. This occurs, for example, with regex engines like the bounded backtracker that have a configurable fixed amount of capacity that is tied to the length of the haystack. Anything beyond that configured limit will result in an error at search time.

UnsupportedAnchored { mode: Anchored }

An error indicating that a particular type of anchored search was requested, but that the regex engine does not support it.

When this error occurs with Anchored::Pattern, then one common cause is that the underlying regex engine was built without support for anchored starting states for each pattern. For DFA engines, this typically means enabling the hybrid::dfa::Config::starts_for_each_pattern or dfa::dense::Config::starts_for_each_pattern configuration option, depending on which regex engine is being built.

Note that this error should not be returned by a regex engine simply because the pattern ID is invalid (i.e., equal to or exceeds the number of patterns in the regex). In that case, the regex engine should report a non-match.

Trait Implementations

impl Clone for MatchErrorKind

fn clone(&self) -> Self

impl Debug for MatchErrorKind

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

impl Eq for MatchErrorKind

impl PartialEq for MatchErrorKind

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

impl StructuralPartialEq for MatchErrorKind

Auto Trait Implementations

impl Freeze for MatchErrorKind

impl RefUnwindSafe for MatchErrorKind

impl Send for MatchErrorKind

impl Sync for MatchErrorKind

impl Unpin for MatchErrorKind

impl UnsafeUnpin for MatchErrorKind

impl UnwindSafe for MatchErrorKind

Blanket Implementations

impl<T> Any for MatchErrorKind where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for MatchErrorKind where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for MatchErrorKind where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for MatchErrorKind where T: Clone,

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

impl<T> From<T> for MatchErrorKind

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for MatchErrorKind where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for MatchErrorKind where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for MatchErrorKind where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for MatchErrorKind where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>