pub enum BeamPattern {
Wildcard,
Var(String),
LitInt(i64),
LitAtom(String),
LitString(String),
Nil,
Cons(Box<BeamPattern>, Box<BeamPattern>),
Tuple(Vec<BeamPattern>),
MapPat(Vec<(BeamExpr, BeamPattern)>),
Alias(String, Box<BeamPattern>),
}Expand description
Patterns for BEAM case expressions.
Variants§
Wildcard
Wildcard: matches anything, binds nothing
Var(String)
Variable binding: matches anything, binds to name
LitInt(i64)
Literal integer
LitAtom(String)
Literal atom
LitString(String)
Literal string
Nil
Nil pattern []
Cons(Box<BeamPattern>, Box<BeamPattern>)
Cons pattern [Head | Tail]
Tuple(Vec<BeamPattern>)
Tuple pattern {P1, P2, ...}
MapPat(Vec<(BeamExpr, BeamPattern)>)
Map pattern #{Key := Var, ...}
Alias(String, Box<BeamPattern>)
Alias pattern Var = Pattern
Trait Implementations§
Source§impl Clone for BeamPattern
impl Clone for BeamPattern
Source§fn clone(&self) -> BeamPattern
fn clone(&self) -> BeamPattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BeamPattern
impl RefUnwindSafe for BeamPattern
impl Send for BeamPattern
impl Sync for BeamPattern
impl Unpin for BeamPattern
impl UnsafeUnpin for BeamPattern
impl UnwindSafe for BeamPattern
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