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

pub enum PatKind {
    Wild,
    Ident(BindingModeSpannedIdentOption<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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for PatKind
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for PatKind
[src]

impl Encodable for PatKind
[src]

[src]

impl Decodable for PatKind
[src]

[src]

impl Hash for PatKind
[src]

[src]

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

1.3.0
[src]

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

impl Debug for PatKind
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !Send for PatKind

impl !Sync for PatKind