Skip to main content

Pattern

Enum Pattern 

Source
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

Source

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

Source

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.

Source

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

Source

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.

Source

pub fn symbol_names(&self) -> BTreeSet<String>

Return sorted, distinct named symbols with their exact spelling.

Includes excluded and permuted symbols; anchors are omitted.

Source

pub fn has_anchors(&self) -> bool

Returns true if this pattern contains any anchors (^ or $).

Source

pub fn has_end_anchor(&self) -> bool

Returns true if any branch contains an end-of-partition anchor.

Source

pub fn has_exclusions(&self) -> bool

Returns true if this pattern contains any exclusion constructs ({- … -}).

Source

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§

Source§

impl Clone for Pattern

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pattern

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Pattern

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Pattern

Source§

impl Hash for Pattern

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Pattern

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Pattern

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Pattern

Auto Trait Implementations§

§

impl Forget for Pattern

§

impl Freeze for Pattern

§

impl Move for Pattern

§

impl RefUnwindSafe for Pattern

§

impl Send for Pattern
where RawVecInner: Send, BoxRaw<Pattern>: Send,

§

impl Sync for Pattern
where RawVecInner: Sync, BoxRaw<Pattern>: Sync,

§

impl Unpin for Pattern
where *const u8 is !null: Unpin, Box<Pattern>: Unpin,

§

impl UnsafeUnpin for Pattern

§

impl UnwindSafe for Pattern
where RawVecInner: UnwindSafe, BoxRaw<Pattern>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynEq for T
where T: Eq + Any,

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

impl<T> DynHash for T
where T: Hash + Any,

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V