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§
Provided Methods§
fn rewrite<F>(self, rewrite: F) -> impl Rule<O>
fn guard<G>(self, guard: G) -> GuardedPattern<Self, G>
fn or<Q>(self, other: Q) -> impl Pattern<O, Bindings = Self::Bindings>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".