Struct rustc_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: HirIdkind: PatKind<'hir>span: Spandefault_binding_modes: boolImplementations
impl<'hir> Pat<'hir>[src]
impl<'hir> Pat<'hir>[src]fn walk_short_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) -> bool[src]
pub fn walk_short(&self, it: impl FnMut(&Pat<'hir>) -> bool) -> bool[src]
pub fn walk_short(&self, it: impl FnMut(&Pat<'hir>) -> bool) -> bool[src]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.
fn walk_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool)[src]
pub fn walk(&self, it: impl FnMut(&Pat<'hir>) -> bool)[src]
pub fn walk(&self, it: impl FnMut(&Pat<'hir>) -> bool)[src]Walk the pattern in left-to-right order.
If it(pat) returns false, the children are not visited.
pub fn walk_always(&self, it: impl FnMut(&Pat<'_>))[src]
pub fn walk_always(&self, it: impl FnMut(&Pat<'_>))[src]Walk the pattern in left-to-right order.
If you always want to recurse, prefer this method over walk.
impl Pat<'_>[src]
impl Pat<'_>[src]pub fn each_binding(&self, f: impl FnMut(BindingAnnotation, HirId, Span, Ident))[src]
pub fn each_binding(&self, f: impl FnMut(BindingAnnotation, HirId, Span, Ident))[src]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)
)[src]
pub fn each_binding_or_first(
&self,
f: &mut impl FnMut(BindingAnnotation, HirId, Span, Ident)
)[src]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.
pub fn simple_ident(&self) -> Option<Ident>[src]
pub fn necessary_variants(&self) -> Vec<DefId>[src]
pub fn necessary_variants(&self) -> Vec<DefId>[src]Returns variants that are necessary to exist for the pattern to match.
pub fn contains_explicit_ref_binding(&self) -> Option<Mutability>[src]
pub fn contains_explicit_ref_binding(&self) -> Option<Mutability>[src]Checks if the pattern contains any ref or ref mut bindings, and if
yes whether it contains mutable or just immutables ones.
Trait Implementations
impl<'hir, __CTX> HashStable<__CTX> for Pat<'hir> where
__CTX: HashStableContext, [src]
impl<'hir, __CTX> HashStable<__CTX> for Pat<'hir> where
__CTX: HashStableContext, [src]