Struct rustc_hir::Crate [−][src]
pub struct Crate<'hir> {
pub non_exported_macro_attrs: &'hir [Attribute],
pub owners: IndexVec<LocalDefId, Option<OwnerNode<'hir>>>,
pub bodies: BTreeMap<BodyId, Body<'hir>>,
pub trait_impls: BTreeMap<DefId, Vec<LocalDefId>>,
pub body_ids: Vec<BodyId>,
pub modules: BTreeMap<LocalDefId, ModuleItems>,
pub proc_macros: Vec<HirId>,
pub trait_map: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, Box<[TraitCandidate]>>>,
pub attrs: BTreeMap<HirId, &'hir [Attribute]>,
}Expand description
The top-level data structure that stores the entire contents of the crate currently being compiled.
For more details, see the rustc dev guide.
Fields
non_exported_macro_attrs: &'hir [Attribute]owners: IndexVec<LocalDefId, Option<OwnerNode<'hir>>>bodies: BTreeMap<BodyId, Body<'hir>>trait_impls: BTreeMap<DefId, Vec<LocalDefId>>body_ids: Vec<BodyId>A list of the body ids written out in the order in which they appear in the crate. If you’re going to process all the bodies in the crate, you should iterate over this list rather than the keys of bodies.
modules: BTreeMap<LocalDefId, ModuleItems>A list of modules written out in the order in which they appear in the crate. This includes the main crate module.
proc_macros: Vec<HirId>A list of proc macro HirIds, written out in the order in which they are declared in the static array generated by proc_macro_harness.
trait_map: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, Box<[TraitCandidate]>>>Map indicating what traits are in scope for places where this is relevant; generated by resolve.
attrs: BTreeMap<HirId, &'hir [Attribute]>Collected attributes from HIR nodes.
Implementations
pub fn visit_all_item_likes<'hir, V>(&'hir self, visitor: &mut V) where
V: ItemLikeVisitor<'hir>,
pub fn visit_all_item_likes<'hir, V>(&'hir self, visitor: &mut V) where
V: ItemLikeVisitor<'hir>,
Visits all items in the crate in some deterministic (but unspecified) order. If you just need to process every item, but don’t care about nesting, this method is the best choice.
If you do care about nesting – usually because your algorithm
follows lexical scoping rules – then you want a different
approach. You should override visit_nested_item in your
visitor and then call intravisit::walk_crate instead.
pub fn par_visit_all_item_likes<'hir, V>(&'hir self, visitor: &V) where
V: ParItemLikeVisitor<'hir> + Sync + Send,
pub fn par_visit_all_item_likes<'hir, V>(&'hir self, visitor: &V) where
V: ParItemLikeVisitor<'hir> + Sync + Send,
A parallel version of visit_all_item_likes.
Trait Implementations
Auto Trait Implementations
impl<'hir> !RefUnwindSafe for Crate<'hir>
impl<'hir> !UnwindSafe for Crate<'hir>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may be different between compiler versions and platforms. 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: 216 bytes