Struct rustc_hir::Pat

source ·
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

Whether to use default binding modes. At present, this is false only for destructuring assignment.

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 => () }

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.

If the pattern is Some(<pat>) from a desugared for loop, returns the inner pattern

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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: 72 bytes