pub enum Pat<A: AstTypes = DefaultTypes> {
Ignore,
Never,
MetId(A::MacroId),
Name(A::Symbol),
Value(Box<At<Expr<A>, A>>),
Op(PatOp, Vec<Pat<A>>),
}Expand description
Binding patterns for each kind of matchable value.
This covers both bindings and type annotations in Bind expressions.
Variants§
Ignore
_: Matches anything without binding
Never
!: Matches nothing, ever
MetId(A::MacroId)
$Token: Matches nothing; used for macro substitution
Name(A::Symbol)
Identifier: Matches anything, and binds it to a name
Value(Box<At<Expr<A>, A>>)
Expr: Matches a value by equality comparison
Op(PatOp, Vec<Pat<A>>)
Matches a compound pattern
Implementations§
Trait Implementations§
Source§impl<A: AstTypes, B: AstTypes> Foldable<A, B> for Pat<A>
impl<A: AstTypes, B: AstTypes> Foldable<A, B> for Pat<A>
Source§impl<A: AstTypes> Match<A> for Pat<A>
impl<A: AstTypes> Match<A> for Pat<A>
Source§fn recurse(sub: &mut Subst<A>, pat: &Self, expr: &Self) -> bool
fn recurse(sub: &mut Subst<A>, pat: &Self, expr: &Self) -> bool
Implements recursive Subst-building for Self
Source§fn apply_rule(&mut self, pat: &Self, template: &Self) -> bool
fn apply_rule(&mut self, pat: &Self, template: &Self) -> bool
Applies a substitution rule from
pat to template on selfSource§fn match_with(&self, pat: &Self) -> Option<Subst<A>>
fn match_with(&self, pat: &Self) -> Option<Subst<A>>
Matches self against the provided pattern
impl<A: Eq + AstTypes> Eq for Pat<A>
impl<A: AstTypes> StructuralPartialEq for Pat<A>
Auto Trait Implementations§
impl<A> Freeze for Pat<A>
impl<A> RefUnwindSafe for Pat<A>where
<A as AstTypes>::MacroId: RefUnwindSafe,
<A as AstTypes>::Symbol: RefUnwindSafe,
<A as AstTypes>::Annotation: RefUnwindSafe,
<A as AstTypes>::Path: RefUnwindSafe,
<A as AstTypes>::Literal: RefUnwindSafe,
impl<A> Send for Pat<A>
impl<A> Sync for Pat<A>
impl<A> Unpin for Pat<A>
impl<A> UnwindSafe for Pat<A>where
<A as AstTypes>::MacroId: UnwindSafe,
<A as AstTypes>::Symbol: UnwindSafe,
<A as AstTypes>::Annotation: UnwindSafe,
<A as AstTypes>::Path: UnwindSafe,
<A as AstTypes>::Literal: UnwindSafe,
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
Mutably borrows from an owned value. Read more