Skip to main content

Pattern

Trait Pattern 

Source
pub trait Pattern<O: Operand> {
    type Bindings;

    // Required method
    fn try_match(&self, operand: &O) -> Option<Self::Bindings>;

    // Provided methods
    fn rewrite<F>(self, rewrite: F) -> impl Rule<O>
       where Self: Sized + Send + Sync + 'static,
             O: 'static,
             F: Fn(Self::Bindings, &Stats<'_>) -> Option<O> + Send + Sync + 'static { ... }
    fn guard<G>(self, guard: G) -> GuardedPattern<Self, G>
       where Self: Sized,
             G: Fn(&Stats<'_>) -> bool { ... }
    fn or<Q>(self, other: Q) -> impl Pattern<O, Bindings = Self::Bindings>
       where Self: Sized,
             Q: Pattern<O, Bindings = Self::Bindings> { ... }
}

Required Associated Types§

Required Methods§

Source

fn try_match(&self, operand: &O) -> Option<Self::Bindings>

Provided Methods§

Source

fn rewrite<F>(self, rewrite: F) -> impl Rule<O>
where Self: Sized + Send + Sync + 'static, O: 'static, F: Fn(Self::Bindings, &Stats<'_>) -> Option<O> + Send + Sync + 'static,

Source

fn guard<G>(self, guard: G) -> GuardedPattern<Self, G>
where Self: Sized, G: Fn(&Stats<'_>) -> bool,

Source

fn or<Q>(self, other: Q) -> impl Pattern<O, Bindings = Self::Bindings>
where Self: Sized, Q: Pattern<O, Bindings = Self::Bindings>,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C, P, B> Pattern<<C as OptimizePlan>::Output> for Matching<C, P>
where C: PlanNode + MatchInputs + OptimizePlan, P: for<'a> MatchAgainst<C::Inputs<'a>, Bindings = B>,

Source§

impl<O: Operand, P: Pattern<O>> Pattern<O> for NotPattern<P>

Source§

impl<O: Operand> Pattern<O> for Capture

Source§

impl<O: Operand> Pattern<O> for Wildcard