pub enum Pat_ {
PatWild(PatWildKind),
PatIdent(BindingMode, SpannedIdent, Option<P<Pat>>),
PatEnum(Path, Option<Vec<P<Pat>>>),
PatStruct(Path, Vec<Spanned<FieldPat>>, bool),
PatTup(Vec<P<Pat>>),
PatBox(P<Pat>),
PatRegion(P<Pat>, Mutability),
PatLit(P<Expr>),
PatRange(P<Expr>, P<Expr>),
PatVec(Vec<P<Pat>>, Option<P<Pat>>, Vec<P<Pat>>),
PatMac(Mac),
}
Variants
PatWild | Represents a wildcard pattern (either _ or .. )
|
PatIdent | A PatIdent may either be a new bound variable,
or a nullary enum (in which case the third field
is None).
In the nullary enum case, the parser can't determine
which it is. The resolver determines this, and
records this pattern's NodeId in an auxiliary
set (of "PatIdents that refer to nullary enums")
|
PatEnum | "None" means a * pattern where we don't bind the fields to names.
|
PatStruct | Destructuring of a struct, e.g. Foo {x, y, ..}
The bool is true in the presence of a ..
|
PatTup | |
PatBox | |
PatRegion | A reference pattern, e.g. &mut (a, b)
|
PatLit | |
PatRange | A range pattern, e.g. 1...2
|
PatVec | [a, b, ..i, y, z] is represented as:
PatVec(box [a, b], Some(i), box [y, z])
|
PatMac | A macro pattern; pre-expansion
|
Trait Implementations
Derived Implementations