[−][src]Struct rustc_hir::hir::Pat
Fields
hir_id: HirIdkind: PatKind<'hir>span: Spandefault_binding_modes: boolImplementations
impl<'_> Pat<'_>[src]
pub(in hir) fn walk_short_(
&self,
it: &mut impl FnMut(&Pat<'_>) -> bool
) -> bool[src]
&self,
it: &mut impl FnMut(&Pat<'_>) -> bool
) -> bool
pub fn walk_short(&self, it: impl FnMut(&Pat<'_>) -> 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.
pub(in hir) fn walk_(
&self,
it: &mut impl FnMut(&Pat<'_>) -> bool
)[src]
&self,
it: &mut impl FnMut(&Pat<'_>) -> bool
)
pub fn walk(&self, it: impl FnMut(&Pat<'_>) -> 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]
Walk the pattern in left-to-right order.
If you always want to recurse, prefer this method over walk.
impl<'_> Pat<'_>[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]
&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.
pub fn contains_bindings(&self) -> bool[src]
Checks if the pattern contains any patterns that bind something to
an ident, e.g., foo, or Foo(foo) or foo @ Bar(..).
pub(in pat_util) fn satisfies(
&self,
pred: impl Fn(&Pat<'_>) -> bool
) -> bool[src]
&self,
pred: impl Fn(&Pat<'_>) -> bool
) -> bool
Checks if the pattern satisfies the given predicate on some sub-pattern.
pub fn simple_ident(&self) -> Option<Ident>[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]
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> Debug for Pat<'hir>[src]
impl<'hir, __CTX> HashStable<__CTX> for Pat<'hir> where
__CTX: HashStableContext, [src]
__CTX: HashStableContext,
pub fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)[src]
Auto Trait Implementations
impl<'hir> !RefUnwindSafe for Pat<'hir>
impl<'hir> !Send for Pat<'hir>
impl<'hir> !Sync for Pat<'hir>
impl<'hir> Unpin for Pat<'hir>
impl<'hir> !UnwindSafe for Pat<'hir>
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,
pub fn borrow_mut(&mut self) -> &mut 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, 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.
pub 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>,