Enum rustc_hir::hir::Node

source ·
pub enum Node<'hir> {
Show 25 variants Param(&'hir Param<'hir>), Item(&'hir Item<'hir>), ForeignItem(&'hir ForeignItem<'hir>), TraitItem(&'hir TraitItem<'hir>), ImplItem(&'hir ImplItem<'hir>), Variant(&'hir Variant<'hir>), Field(&'hir FieldDef<'hir>), AnonConst(&'hir AnonConst), Expr(&'hir Expr<'hir>), ExprField(&'hir ExprField<'hir>), Stmt(&'hir Stmt<'hir>), PathSegment(&'hir PathSegment<'hir>), Ty(&'hir Ty<'hir>), TypeBinding(&'hir TypeBinding<'hir>), TraitRef(&'hir TraitRef<'hir>), Pat(&'hir Pat<'hir>), PatField(&'hir PatField<'hir>), Arm(&'hir Arm<'hir>), Block(&'hir Block<'hir>), Local(&'hir Local<'hir>), Ctor(&'hir VariantData<'hir>), Lifetime(&'hir Lifetime), GenericParam(&'hir GenericParam<'hir>), Crate(&'hir Mod<'hir>), Infer(&'hir InferArg),
}

Variants§

§

Param(&'hir Param<'hir>)

§

Item(&'hir Item<'hir>)

§

ForeignItem(&'hir ForeignItem<'hir>)

§

TraitItem(&'hir TraitItem<'hir>)

§

ImplItem(&'hir ImplItem<'hir>)

§

Variant(&'hir Variant<'hir>)

§

Field(&'hir FieldDef<'hir>)

§

AnonConst(&'hir AnonConst)

§

Expr(&'hir Expr<'hir>)

§

ExprField(&'hir ExprField<'hir>)

§

Stmt(&'hir Stmt<'hir>)

§

PathSegment(&'hir PathSegment<'hir>)

§

Ty(&'hir Ty<'hir>)

§

TypeBinding(&'hir TypeBinding<'hir>)

§

TraitRef(&'hir TraitRef<'hir>)

§

Pat(&'hir Pat<'hir>)

§

PatField(&'hir PatField<'hir>)

§

Arm(&'hir Arm<'hir>)

§

Block(&'hir Block<'hir>)

§

Local(&'hir Local<'hir>)

§

Ctor(&'hir VariantData<'hir>)

Ctor refers to the constructor of an enum variant or struct. Only tuple or unit variants with synthesized constructors.

§

Lifetime(&'hir Lifetime)

§

GenericParam(&'hir GenericParam<'hir>)

§

Crate(&'hir Mod<'hir>)

§

Infer(&'hir InferArg)

Implementations§

Get the identifier of this Node, if applicable.

Edge cases

Calling .ident() on a Node::Ctor will return None because Ctors do not have identifiers themselves. Instead, call .ident() on the parent struct/variant, like so:

ctor
    .ctor_hir_id()
    .and_then(|ctor_id| tcx.hir().find(tcx.hir().get_parent_node(ctor_id)))
    .and_then(|parent| parent.ident())

Get the fields for the tuple-constructor, if this node is a tuple constructor, otherwise None

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts this type into the (usually inferred) input type.

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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: 16 bytes

Size for each variant:

  • Param: 8 bytes
  • Item: 8 bytes
  • ForeignItem: 8 bytes
  • TraitItem: 8 bytes
  • ImplItem: 8 bytes
  • Variant: 8 bytes
  • Field: 8 bytes
  • AnonConst: 8 bytes
  • Expr: 8 bytes
  • ExprField: 8 bytes
  • Stmt: 8 bytes
  • PathSegment: 8 bytes
  • Ty: 8 bytes
  • TypeBinding: 8 bytes
  • TraitRef: 8 bytes
  • Pat: 8 bytes
  • PatField: 8 bytes
  • Arm: 8 bytes
  • Block: 8 bytes
  • Local: 8 bytes
  • Ctor: 8 bytes
  • Lifetime: 8 bytes
  • GenericParam: 8 bytes
  • Crate: 8 bytes
  • Infer: 8 bytes