pub enum Pattern {
Wildcard,
Var(String),
Ctor {
name: String,
args: Vec<Pattern>,
},
Numeral(u64),
}Expand description
A surface pattern, exactly as a When clause spells it.
Variants§
Wildcard
_ — matches anything, binds nothing.
Var(String)
k — matches anything, binds the name to the whole matched value.
Ctor
Succ (Succ k) — a constructor applied to one sub-pattern per VALUE field.
Numeral(u64)
0, 2, 17 — a NUMERAL, which is the unary spelling of that number in the inductive
the column has. Lean’s | 0 => … | 1 => … (Lean/Meta/Match/Match.lean:629
expandNatValuePattern, reached through isNatValueTransition at :171) expands a Nat
literal pattern into Nat.zero/Nat.succ applications before the matrix ever sees it,
and so does this compiler — see peano_shape, which derives the pair from the
declaration rather than hard-coding Nat, so a user’s own unary numeral type works too.
Implementations§
Trait Implementations§
impl Eq for Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl UnwindSafe for Pattern
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