pub enum PurePattern {
Ident {
name: String,
is_mut: bool,
},
Wild,
Tuple(Vec<PurePattern>),
Struct {
path: String,
fields: Vec<(String, PurePattern)>,
rest: bool,
},
Ref {
is_mut: bool,
pattern: Box<PurePattern>,
},
Lit(String),
Or(Vec<PurePattern>),
Path(String),
Range {
start: Option<String>,
end: Option<String>,
inclusive: bool,
},
Slice(Vec<PurePattern>),
Rest,
Other(String),
}Expand description
A pattern.
Variants§
Ident
Identifier: x, mut x
Wild
Wildcard: _
Tuple(Vec<PurePattern>)
Tuple: (a, b)
Struct
Struct: Point { x, y } or Point { x, .. }
Fields
§
fields: Vec<(String, PurePattern)>Field bindings (name, sub-pattern).
Ref
Reference: &x, &mut x
Lit(String)
Literal (for matching).
Or(Vec<PurePattern>)
Or pattern: A | B
Path(String)
Path pattern: Some, None, Enum::Variant
Range
Range pattern: 1..=5, 'a'..='z'
Fields
Slice(Vec<PurePattern>)
Slice pattern: [a, b, ..]
Rest
Rest pattern: ..
Other(String)
Other (as string) - unsupported patterns with error guidance.
Trait Implementations§
Source§impl Clone for PurePattern
impl Clone for PurePattern
Source§fn clone(&self) -> PurePattern
fn clone(&self) -> PurePattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PurePattern
impl Debug for PurePattern
Source§impl PartialEq for PurePattern
impl PartialEq for PurePattern
Source§fn eq(&self, other: &PurePattern) -> bool
fn eq(&self, other: &PurePattern) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl ToSyn for PurePattern
impl ToSyn for PurePattern
impl Eq for PurePattern
impl StructuralPartialEq for PurePattern
Auto Trait Implementations§
impl Freeze for PurePattern
impl RefUnwindSafe for PurePattern
impl Send for PurePattern
impl Sync for PurePattern
impl Unpin for PurePattern
impl UnsafeUnpin for PurePattern
impl UnwindSafe for PurePattern
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