Struct rustc_hir::hir::Pat [−][src]
pub struct Pat<'hir> {
pub hir_id: HirId,
pub kind: PatKind<'hir>,
pub span: Span,
pub default_binding_modes: bool,
}
Fields
hir_id: HirId
kind: PatKind<'hir>
span: Span
default_binding_modes: bool
Implementations
Walk the pattern in left-to-right order,
short circuiting (with .all(..)
) if false
is returned.
Note that when visiting e.g. Tuple(ps)
,
if visiting ps[0]
returns false
,
then ps[1]
will not be visited.
Walk the pattern in left-to-right order.
If it(pat)
returns false
, the children are not visited.
Walk the pattern in left-to-right order.
If you always want to recurse, prefer this method over walk
.
Call f
on every “binding” in a pattern, e.g., on a
in
match foo() { Some(a) => (), None => () }
pub fn each_binding_or_first(
&self,
f: &mut impl FnMut(BindingAnnotation, HirId, Span, Ident)
)
pub fn each_binding_or_first(
&self,
f: &mut impl FnMut(BindingAnnotation, HirId, Span, Ident)
)
Call f
on every “binding” in a pattern, e.g., on a
in
match foo() { Some(a) => (), None => () }
.
When encountering an or-pattern p_0 | ... | p_n
only p_0
will be visited.
Returns variants that are necessary to exist for the pattern to match.
Checks if the pattern contains any ref
or ref mut
bindings, and if
yes whether it contains mutable or just immutables ones.
Trait Implementations
Auto Trait Implementations
impl<'hir> !RefUnwindSafe for Pat<'hir>
impl<'hir> !UnwindSafe for Pat<'hir>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 88 bytes