pub enum Pattern {
Ident {
id: HirId,
name: Symbol,
mutable: bool,
ty: Ty,
},
Wildcard {
id: HirId,
ty: Ty,
},
Tuple {
id: HirId,
patterns: Vec<Self>,
ty: Ty,
},
Struct {
id: HirId,
def_id: HirId,
fields: Vec<FieldPattern>,
ty: Ty,
},
Variant {
id: HirId,
enum_name: Symbol,
variant_name: Symbol,
fields: Vec<Self>,
ty: Ty,
},
Literal {
id: HirId,
value: LitValue,
ty: Ty,
},
Or {
id: HirId,
patterns: Vec<Self>,
ty: Ty,
},
Range {
id: HirId,
lo: LitValue,
hi: LitValue,
inclusive: bool,
ty: Ty,
},
}Expand description
Pattern (simplified from AST)
Variants§
Ident
Identifier pattern
Wildcard
Wildcard pattern
Tuple
Tuple pattern
Struct
Struct pattern
Variant
Enum variant pattern (e.g., Result::Ok(value), Option::Some(x))
Literal
Literal pattern (e.g., ‘a’, 42, true)
Or
Or-pattern (e.g., 1 | 2 | 3)
Range
Range pattern (e.g., 1..=10, 'a'..='z')
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin 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