pub enum Pattern {
Wildcard(Span),
Literal(Expr),
Binding {
name: String,
mutable: bool,
span: Span,
},
Struct {
name: String,
fields: Vec<(String, Pattern)>,
rest: bool,
span: Span,
},
Tuple(Vec<Pattern>, Span),
Variant {
enum_name: Option<String>,
variant: String,
fields: VariantPatternFields,
span: Span,
},
Slice {
patterns: Vec<Pattern>,
rest: Option<String>,
span: Span,
},
Or(Vec<Pattern>, Span),
Range {
start: Option<Box<Expr>>,
end: Option<Box<Expr>>,
inclusive: bool,
span: Span,
},
}Variants§
Wildcard(Span)
Wildcard: _
Literal(Expr)
Literal: 1, "hello", true
Binding
Binding: x, mut x
Struct
Struct: Point { x, y }
Tuple(Vec<Pattern>, Span)
Tuple: (a, b, c)
Variant
Enum variant: Some(x), None
Slice
Array/Slice: [first, rest @ ..]
Or(Vec<Pattern>, Span)
Or pattern: A | B
Range
Range: 1..10
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