Struct rustc_hir::hir::Crate [−][src]
pub struct Crate<'hir> {
pub owners: IndexVec<LocalDefId, Option<OwnerNode<'hir>>>,
pub bodies: BTreeMap<BodyId, Body<'hir>>,
pub modules: BTreeMap<LocalDefId, ModuleItems>,
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
owners: IndexVec<LocalDefId, Option<OwnerNode<'hir>>>bodies: BTreeMap<BodyId, Body<'hir>>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.
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: 128 bytes