Enum syn::Pat [] [src]

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

Variants

Represents a wildcard pattern (_)

A Pat::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. Unquailfied path patterns A::B::C can legally refer to variants, structs, constants or associated constants. Quailfied 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

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

A macro pattern; pre-expansion

Trait Implementations

impl ToTokens for Pat
[src]

[src]

Write self to the given Tokens. Read more

impl Debug for Pat
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Pat
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Pat
[src]

impl PartialEq for Pat
[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 Hash for Pat
[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