Struct rustc::hir::Pat
[−]
[src]
pub struct Pat {
pub id: NodeId,
pub hir_id: HirId,
pub node: PatKind,
pub span: Span,
}🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Fields
id: NodeId
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
hir_id: HirId
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
node: PatKind
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
span: Span
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Methods
impl Pat[src]
pub fn is_refutable(&self) -> bool[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn is_const(&self) -> bool[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn each_binding<F>(&self, f: F) where
F: FnMut(BindingAnnotation, NodeId, Span, &Spanned<Name>), [src]
F: FnMut(BindingAnnotation, NodeId, Span, &Spanned<Name>),
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Call f on every "binding" in a pattern, e.g., on a in
match foo() { Some(a) => (), None => () }
pub fn contains_bindings(&self) -> bool[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Checks if the pattern contains any patterns that bind something to
an ident, e.g. foo, or Foo(foo) or foo @ Bar(..).
pub fn contains_bindings_or_wild(&self) -> bool[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Checks if the pattern contains any patterns that bind something to
an ident or wildcard, e.g. foo, or Foo(_), foo @ Bar(..),
pub fn simple_name(&self) -> Option<Name>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn necessary_variants(&self) -> Vec<DefId>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Return variants that are necessary to exist for the pattern to match.
pub fn contains_explicit_ref_binding(&self) -> Option<Mutability>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Checks if the pattern contains any ref or ref mut bindings, and if
yes whether it contains mutable or just immutables ones.
FIXME(tschottdorf): this is problematic as the HIR is being scraped, but ref bindings are be implicit after #42640 (default match binding modes).
See #44848.
impl Pat[src]
pub fn walk<F>(&self, it: F) -> bool where
F: FnMut(&Pat) -> bool, [src]
F: FnMut(&Pat) -> bool,
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Trait Implementations
impl Clone for Pat[src]
fn clone(&self) -> Pat[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for Pat[src]
fn eq(&self, __arg_0: &Pat) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Pat) -> bool[src]
This method tests for !=.
impl Eq for Pat[src]
impl Encodable for Pat[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Decodable for Pat[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Pat, __D::Error>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Hash for Pat[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for Pat[src]
fn fmt(&self, f: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl<'gcx> HashStable<StableHashingContext<'gcx>> for Pat[src]
fn hash_stable<W: StableHasherResult>(
&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>
)[src]
&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>
)
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl ast_node for Pat[src]
fn id(&self) -> NodeId[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn span(&self) -> Span[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?