#[non_exhaustive]pub enum Pat {
Var {
name: Identifier,
pos: Pos,
span: Span,
},
Wild {
pos: Pos,
span: Span,
},
Con {
qualifier: Option<ModuleName>,
name: Identifier,
args: Vec<Self>,
pos: Pos,
span: Span,
},
Record {
qualifier: Option<ModuleName>,
name: Identifier,
syntax: RecordPatternSyntax,
fields: Vec<PatFieldAssign>,
pos: Pos,
span: Span,
},
Tuple {
items: Vec<Self>,
pos: Pos,
span: Span,
},
List {
items: Vec<Self>,
pos: Pos,
span: Span,
},
Lit {
kind: LitKind,
text: String,
pos: Pos,
span: Span,
},
As {
name: Identifier,
pat: Box<Self>,
pos: Pos,
span: Span,
},
Other {
raw: String,
pos: Pos,
span: Span,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Var
Variable pattern.
Fields
§
name: IdentifierBound variable name.
Wild
Wildcard pattern (_).
Con
Constructor pattern with source-ordered arguments.
Fields
§
qualifier: Option<ModuleName>Optional module qualifier before the constructor name.
§
name: IdentifierConstructor name.
Record
Constructor record pattern with source-ordered fields.
Fields
§
qualifier: Option<ModuleName>Optional module qualifier before the constructor name.
§
name: IdentifierConstructor name.
§
syntax: RecordPatternSyntaxWhether fields used {..} or with.
§
fields: Vec<PatFieldAssign>Field patterns in source order.
Tuple
Tuple pattern with source-ordered items.
Fields
List
List pattern with source-ordered items.
Fields
Lit
Literal pattern; text is the parser’s normalized literal text.
Fields
As
name@pat
Fields
§
name: IdentifierName bound to the whole matched pattern.
Other
Anything the parser couldn’t classify; raw text preserved.
Implementations§
Trait Implementations§
impl Eq for Pat
impl StructuralPartialEq for Pat
Auto Trait Implementations§
impl Freeze for Pat
impl RefUnwindSafe for Pat
impl Send for Pat
impl Sync for Pat
impl Unpin for Pat
impl UnsafeUnpin for Pat
impl UnwindSafe for Pat
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