Enum syntax::ast::PatKind[][src]

pub enum PatKind {
    Wild,
    Ident(BindingModeIdentOption<P<Pat>>),
    Struct(PathVec<Spanned<FieldPat>>, bool),
    TupleStruct(PathVec<P<Pat>>, Option<usize>),
    Path(Option<QSelf>, Path),
    Tuple(Vec<P<Pat>>, Option<usize>),
    Box(P<Pat>),
    Ref(P<Pat>, Mutability),
    Lit(P<Expr>),
    Range(P<Expr>, P<Expr>, RangeEnd),
    Slice(Vec<P<Pat>>, Option<P<Pat>>, Vec<P<Pat>>),
    Paren(P<Pat>),
    Mac(Mac),
}

Variants

Represents a wildcard pattern (_)

A PatKind::Ident may either be a new bound variable (ref mut binding @ OPT_SUBPATTERN), or a unit struct/variant pattern, or a const pattern (in the last two cases the third field must be None). Disambiguation cannot be done with parser alone, so it happens during name resolution.

A struct or struct variant pattern, e.g. Variant {x, y, ..}. The bool is true in the presence of a ...

A tuple struct/variant pattern Variant(x, y, .., z). If the .. pattern fragment is present, then Option<usize> denotes its position. 0 <= position <= subpats.len()

A possibly qualified path pattern. Unqualified path patterns A::B::C can legally refer to variants, structs, constants or associated constants. Qualified path patterns <A>::B::C/<A as Trait>::B::C can only legally refer to associated constants.

A tuple pattern (a, b). If the .. pattern fragment is present, then Option<usize> denotes its position. 0 <= position <= subpats.len()

A box pattern

A reference pattern, e.g. &mut (a, b)

A literal

A range pattern, e.g. 1...2, 1..=2 or 1..2

[a, b, ..i, y, z] is represented as: PatKind::Slice(box [a, b], Some(i), box [y, z])

Parentheses in patters used for grouping, i.e. (PAT).

A macro pattern; pre-expansion

Trait Implementations

impl Clone for PatKind
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for PatKind
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for PatKind
[src]

impl Encodable for PatKind
[src]

impl Decodable for PatKind
[src]

impl Hash for PatKind
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for PatKind
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !Send for PatKind

impl !Sync for PatKind