pub enum Pattern {
Wildcard,
Var(Name),
Constructor(Name, Vec<Pattern>),
Literal(Literal),
As(Name, Box<Pattern>),
Or(Vec<Pattern>),
Inaccessible(Expr),
}Expand description
A pattern in a match expression.
Variants§
Wildcard
Wildcard: matches anything
Var(Name)
Variable binding: matches anything, binds the value
Constructor(Name, Vec<Pattern>)
Constructor application: C p1 p2 ...
Literal(Literal)
Literal: matches a specific literal
As(Name, Box<Pattern>)
As-pattern: x @ p (bind and match)
Or(Vec<Pattern>)
Or-pattern: p1 | p2
Inaccessible(Expr)
Inaccessible pattern: .( expr )
Trait Implementations§
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