#[non_exhaustive]pub enum RegexCompileError {
Parse {
pattern_index: usize,
message: String,
},
Unsupported {
pattern_index: usize,
feature: &'static str,
},
TooManyStates {
states: usize,
cap: usize,
},
PatternCountOverflow {
count: usize,
},
MatchLengthOverflow {
pattern_index: usize,
len: usize,
},
TableWordCountOverflow {
table: &'static str,
},
StorageReserveFailed {
field: &'static str,
requested: usize,
message: String,
},
}Expand description
Failure modes for compile_regex_set. Variants are non-exhaustive
so future regex features can be added without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse
regex-syntax rejected the pattern. Carries the parser’s own
diagnostic so callers can forward it.
Fields
Unsupported
The pattern uses a regex feature this GPU NFA frontend does not support. Callers must reject or rewrite the detector into supported GPU-NFA rule data.
Fields
TooManyStates
The compiled NFA exceeds LANES * 32 states (the lane-major
transition table addresses states with one bit per lane).
Mitigation: split the pattern set across multiple pipelines.
PatternCountOverflow
Pattern count does not fit the GPU ABI’s u32 pattern id field.
MatchLengthOverflow
A compiled regex match length does not fit the u32 match ABI.
Fields
TableWordCountOverflow
Transition or epsilon table word count overflowed host usize.
StorageReserveFailed
Compiler staging allocation failed.
Implementations§
Source§impl RegexCompileError
impl RegexCompileError
Sourcepub fn diagnostic_code(&self) -> Option<&'static str>
pub fn diagnostic_code(&self) -> Option<&'static str>
The canonical REGEX_UNSUPPORTED_DIAGNOSTICS.toml diagnostic code for
this error, or None when the error does not correspond to a tracked
unsupported-construct in that registry.
A consumer routes on this code, e.g. a *_REQUIRES_VERIFIER code means
“send this detector to the scalar verifier”, while a *_UNSUPPORTED_*
code means “reject or rewrite”. It returns Some only for constructs the
GPU-NFA frontend can distinctly identify AND that have a registry code
today (ASCII lookaround assertions and over-budget Unicode classes); it
invents no codes. Parse errors, state-budget overflow, and ABI-sizing
failures return None: they are not registry constructs. As the frontend
learns to distinguish more constructs (backreferences, captures, huge
alternations, nested repeats), map them here against their registry codes.
The feature strings matched below are this crate’s own construction-site
constants (not upstream parser text), so the mapping is stable; the
regex_compile_diagnostic_codes test locks the real compile path to them.
Trait Implementations§
Source§impl Clone for RegexCompileError
impl Clone for RegexCompileError
Source§fn clone(&self) -> RegexCompileError
fn clone(&self) -> RegexCompileError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegexCompileError
impl Debug for RegexCompileError
Source§impl Display for RegexCompileError
impl Display for RegexCompileError
Source§impl Error for RegexCompileError
impl Error for RegexCompileError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<RegexCompileError> for RegexDfaError
impl From<RegexCompileError> for RegexDfaError
Source§fn from(error: RegexCompileError) -> Self
fn from(error: RegexCompileError) -> Self
Auto Trait Implementations§
impl Freeze for RegexCompileError
impl RefUnwindSafe for RegexCompileError
impl Send for RegexCompileError
impl Sync for RegexCompileError
impl Unpin for RegexCompileError
impl UnsafeUnpin for RegexCompileError
impl UnwindSafe for RegexCompileError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more