pub enum Pattern {
Wildcard(Span),
Name(Ident),
Variant(VariantPattern),
}Expand description
A match pattern, one level deep (spec 2.3). Not in milestone 2, each
V0001: nested patterns, literal patterns, guards (pattern if cond),
alternatives (a | b), rest patterns (..), range patterns, and @
bindings.
Variants§
Wildcard(Span)
_: matches anything, binds nothing.
Name(Ident)
A bare name: matches anything and binds it. The parser cannot tell
this apart from a zero-argument variant written without its type
(None): the type checker (task 8) decides against the matched
value’s type.
Variant(VariantPattern)
A variant, optionally reached through a type and a module:
Point, Some(p), Shape::Circle(p, q), geo::Shape::Point.
Implementations§
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