pub enum Pattern {
Wildcard,
Literal(Literal),
Ident(String),
EmptyList,
Cons(String, String),
Tuple(Vec<Pattern>),
Constructor(String, Vec<String>),
}Variants§
Wildcard
Literal(Literal)
Ident(String)
EmptyList
Empty list pattern: []
Cons(String, String)
Cons-like list pattern: [head, ..tail]
Tuple(Vec<Pattern>)
Tuple pattern: (a, b) / (_, x) / nested tuples.
Constructor(String, Vec<String>)
Constructor pattern: name + list of binding names. Built-ins: Ok(x), Err(x), Some(x), None → vec![“x”] or vec![] User-defined: Circle(r), Rect(w, h), Point → vec![“r”], vec![“w”,“h”], vec![]
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