pub enum Pattern {
Variant {
name: String,
sub: Vec<Pattern>,
span: Span,
},
Wildcard {
span: Span,
},
Binding {
name: String,
span: Span,
},
Int {
value: i64,
span: Span,
},
Float {
value: f64,
span: Span,
},
Byte {
value: u8,
span: Span,
},
Str {
value: String,
span: Span,
},
Bool {
value: bool,
span: Span,
},
}Expand description
a pattern in a match arm. v1 has variant destructure (with sub-patterns),
the _ wildcard, a name binding, and literal patterns; no or-patterns, no
struct patterns, no nested guards (guards live on the MatchArm).
Variants§
Variant
Name(sub, ...) – destructure an enum variant; sub is the
sub-patterns for its fields (empty for a no-data variant matched as
Name). whether Name is a real variant is Phase 3’s call.
Wildcard
_ – matches anything, binds nothing.
Binding
name – matches anything, binds it to name.
Int
an integer literal pattern.
Float
a float literal pattern.
Byte
a byte literal pattern.
Str
a string literal pattern.
Bool
a boolean literal pattern, true or false.
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