pub enum Pattern {
Symbol(Symbol),
Exclude(Symbol),
Permute(Vec<Symbol>),
Concat(Vec<Pattern>),
Group(Box<Pattern>),
Alternation(Vec<Pattern>),
Repetition(Box<Pattern>, RepetitionQuantifier),
}Expand description
A pattern for matching in MATCH_RECOGNIZE.
Variants§
Symbol(Symbol)
A single symbol
Exclude(Symbol)
An excluded symbol
Permute(Vec<Symbol>)
A permutation of symbols
Concat(Vec<Pattern>)
A concatenation of patterns
Group(Box<Pattern>)
A grouped pattern
Alternation(Vec<Pattern>)
An alternation of patterns
Repetition(Box<Pattern>, RepetitionQuantifier)
A pattern with repetition
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn structural_info(&self) -> PatternStructuralInfo
pub fn structural_info(&self) -> PatternStructuralInfo
Returns shared structural facts for this pattern.
This calculates the pattern properties commonly needed by planning, optimization, and compilation in one traversal.
Source§impl Pattern
impl Pattern
Sourcepub fn max_match_rows(&self) -> Option<usize>
pub fn max_match_rows(&self) -> Option<usize>
Return a structural upper bound on matched rows, when representable.
Returns None for unbounded repetitions or when the calculated bound
overflows usize.
This is used to determine eligibility for parallel execution without PARTITION BY, where bounded patterns allow safe chunk splitting.
Sourcepub fn min_match_rows(&self) -> usize
pub fn min_match_rows(&self) -> usize
Returns the minimum number of rows this pattern can match.
This is a conservative structural property derived from the pattern AST:
- Named symbols consume 1 row
- Anchors (
^/$) consume 0 rows - Concatenation sums minima
- Alternation takes the minimum across branches
- Repetition uses the lower bound of the quantifier (0 for
*,?,{,n})
This is useful for determining if a pattern can match the empty string
(min_match_rows() == 0).
Source§impl Pattern
impl Pattern
Sourcepub fn has_reluctant_choice(&self) -> bool
pub fn has_reluctant_choice(&self) -> bool
Returns true when a repetition can choose to exit before continuing.
Fixed-count reluctant spellings have no such choice.
Sourcepub fn symbol_names(&self) -> BTreeSet<String>
pub fn symbol_names(&self) -> BTreeSet<String>
Return sorted, distinct named symbols with their exact spelling.
Includes excluded and permuted symbols; anchors are omitted.
Sourcepub fn has_anchors(&self) -> bool
pub fn has_anchors(&self) -> bool
Returns true if this pattern contains any anchors (^ or $).
Sourcepub fn has_end_anchor(&self) -> bool
pub fn has_end_anchor(&self) -> bool
Returns true if any branch contains an end-of-partition anchor.
Sourcepub fn has_exclusions(&self) -> bool
pub fn has_exclusions(&self) -> bool
Returns true if this pattern contains any exclusion constructs ({- … -}).
Sourcepub fn single_symbol_name(&self) -> Option<&str>
pub fn single_symbol_name(&self) -> Option<&str>
Identify the symbol in a repetition whose preference follows its endpoint.
The outer repetition is fixed-count or prefers continuation. Its body is a named symbol, optionally wrapped in groups and fixed-count repetitions.
Trait Implementations§
impl Eq for Pattern
Source§impl PartialOrd for Pattern
impl PartialOrd for Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Forget for Pattern
impl Freeze for Patternwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Symbol>: Freeze,
PhantomData<Pattern>: Freeze,
*const Pattern is !null: Freeze,
impl Move for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Patternwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Symbol>: UnsafeUnpin,
PhantomData<Pattern>: UnsafeUnpin,
*const Pattern is !null: UnsafeUnpin,
impl UnwindSafe for Pattern
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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