[−][src]Enum rustc_ap_rustc_ast::ast::PatKind
Variants
Represents a wildcard pattern (_
).
Ident(BindingMode, Ident, Option<P<Pat>>)
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)
).
An or-pattern A | B | C
.
Invariant: pats.len() >= 2
.
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)
).
A box
pattern.
Ref(P<Pat>, Mutability)
A reference pattern (e.g., &mut (a, b)
).
A literal.
A range pattern (e.g., 1...2
, 1..=2
or 1..2
).
A slice pattern [a, b, c]
.
A rest pattern ..
.
Syntactically it is valid anywhere.
Semantically however, it only has meaning immediately inside:
- a slice pattern:
[a, .., b]
, - a binding pattern immediately inside a slice pattern:
[a, r @ ..]
, - a tuple pattern:
(a, .., b)
, - a tuple struct/variant pattern:
$path(a, .., b)
.
In all of these cases, an additional restriction applies, only one rest pattern may occur in the pattern sequences.
Parentheses in patterns used for grouping (i.e., (PAT)
).
MacCall(MacCall)
A macro pattern; pre-expansion.
Trait Implementations
impl Clone for PatKind
[src]
impl Debug for PatKind
[src]
impl<__D: Decoder> Decodable<__D> for PatKind
[src]
impl<__E: Encoder> Encodable<__E> for PatKind
[src]
Auto Trait Implementations
impl !RefUnwindSafe for PatKind
impl !Send for PatKind
impl !Sync for PatKind
impl Unpin for PatKind
impl !UnwindSafe for PatKind
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,