Enum rustc_hir::hir::Node [−][src]
pub enum Node<'hir> {
Show 24 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>),
Stmt(&'hir Stmt<'hir>),
PathSegment(&'hir PathSegment<'hir>),
Ty(&'hir Ty<'hir>),
TraitRef(&'hir TraitRef<'hir>),
Binding(&'hir Pat<'hir>),
Pat(&'hir Pat<'hir>),
Arm(&'hir Arm<'hir>),
Block(&'hir Block<'hir>),
Local(&'hir Local<'hir>),
Ctor(&'hir VariantData<'hir>),
Lifetime(&'hir Lifetime),
GenericParam(&'hir GenericParam<'hir>),
Visibility(&'hir Visibility<'hir>),
Crate(&'hir Mod<'hir>),
Infer(&'hir InferArg),
}
Variants
Param(&'hir Param<'hir>)
Tuple Fields of Param
0: &'hir Param<'hir>
Item(&'hir Item<'hir>)
Tuple Fields of Item
0: &'hir Item<'hir>
ForeignItem(&'hir ForeignItem<'hir>)
Tuple Fields of ForeignItem
0: &'hir ForeignItem<'hir>
TraitItem(&'hir TraitItem<'hir>)
Tuple Fields of TraitItem
0: &'hir TraitItem<'hir>
ImplItem(&'hir ImplItem<'hir>)
Tuple Fields of ImplItem
0: &'hir ImplItem<'hir>
Variant(&'hir Variant<'hir>)
Tuple Fields of Variant
0: &'hir Variant<'hir>
Field(&'hir FieldDef<'hir>)
Tuple Fields of Field
0: &'hir FieldDef<'hir>
AnonConst(&'hir AnonConst)
Tuple Fields of AnonConst
0: &'hir AnonConst
Expr(&'hir Expr<'hir>)
Tuple Fields of Expr
0: &'hir Expr<'hir>
Stmt(&'hir Stmt<'hir>)
Tuple Fields of Stmt
0: &'hir Stmt<'hir>
PathSegment(&'hir PathSegment<'hir>)
Tuple Fields of PathSegment
0: &'hir PathSegment<'hir>
Ty(&'hir Ty<'hir>)
Tuple Fields of Ty
0: &'hir Ty<'hir>
TraitRef(&'hir TraitRef<'hir>)
Tuple Fields of TraitRef
0: &'hir TraitRef<'hir>
Binding(&'hir Pat<'hir>)
Tuple Fields of Binding
0: &'hir Pat<'hir>
Pat(&'hir Pat<'hir>)
Tuple Fields of Pat
0: &'hir Pat<'hir>
Arm(&'hir Arm<'hir>)
Tuple Fields of Arm
0: &'hir Arm<'hir>
Block(&'hir Block<'hir>)
Tuple Fields of Block
0: &'hir Block<'hir>
Local(&'hir Local<'hir>)
Tuple Fields of Local
0: &'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.
Tuple Fields of Ctor
0: &'hir VariantData<'hir>
Lifetime(&'hir Lifetime)
Tuple Fields of Lifetime
0: &'hir Lifetime
GenericParam(&'hir GenericParam<'hir>)
Tuple Fields of GenericParam
0: &'hir GenericParam<'hir>
Visibility(&'hir Visibility<'hir>)
Tuple Fields of Visibility
0: &'hir Visibility<'hir>
Crate(&'hir Mod<'hir>)
Tuple Fields of Crate
0: &'hir Mod<'hir>
Infer(&'hir InferArg)
Tuple Fields of Infer
0: &'hir InferArg
Implementations
Get the identifier of this Node
, if applicable.
Edge cases
Calling .ident()
on a Node::Ctor
will return None
because Ctor
s 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())
Returns Constness::Const
when this node is a const fn/impl/item.
Trait Implementations
Auto Trait Implementations
impl<'hir> !RefUnwindSafe for Node<'hir>
impl<'hir> !UnwindSafe for Node<'hir>
Blanket Implementations
Mutably borrows from an owned value. Read more
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 bytesItem
: 8 bytesForeignItem
: 8 bytesTraitItem
: 8 bytesImplItem
: 8 bytesVariant
: 8 bytesField
: 8 bytesAnonConst
: 8 bytesExpr
: 8 bytesStmt
: 8 bytesPathSegment
: 8 bytesTy
: 8 bytesTraitRef
: 8 bytesBinding
: 8 bytesPat
: 8 bytesArm
: 8 bytesBlock
: 8 bytesLocal
: 8 bytesCtor
: 8 bytesLifetime
: 8 bytesGenericParam
: 8 bytesVisibility
: 8 bytesCrate
: 8 bytesInfer
: 8 bytes