pub enum Pat {
Ident(PatIdent),
Path(PatPath),
Reference(PatReference),
Struct(PatStruct),
Tuple(PatTuple),
TupleStruct(PatTupleStruct),
Type(PatType),
Wild(PatWild),
// some variants omitted
}
Expand description
A pattern in a local binding, function signature, match expression, or various other places.
Syntax tree enum
This type is a syntax tree enum.
Variants§
Ident(PatIdent)
A pattern that binds a new variable: ref mut binding @ SUBPATTERN
.
Path(PatPath)
A path pattern like Color::Red
.
Reference(PatReference)
A reference pattern: &mut var
.
Struct(PatStruct)
A struct or struct variant pattern: Variant { x, y, .. }
.
Tuple(PatTuple)
A tuple pattern: (a, b)
.
TupleStruct(PatTupleStruct)
A tuple struct or tuple variant pattern: Variant(x, y, .., z)
.
Type(PatType)
A type ascription pattern: foo: f64
.
Wild(PatWild)
A pattern that matches any value: _
.
Trait Implementations§
source§impl From<PatReference> for Pat
impl From<PatReference> for Pat
source§fn from(e: PatReference) -> Pat
fn from(e: PatReference) -> Pat
Converts to this type from the input type.
source§impl From<PatTupleStruct> for Pat
impl From<PatTupleStruct> for Pat
source§fn from(e: PatTupleStruct) -> Pat
fn from(e: PatTupleStruct) -> Pat
Converts to this type from the input type.
source§impl ToTokens for Pat
impl ToTokens for Pat
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere Self: Sized,
Auto Trait Implementations§
impl RefUnwindSafe for Pat
impl !Send for Pat
impl !Sync for Pat
impl Unpin for Pat
impl UnwindSafe for Pat
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
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.