[−][src]Struct rustc_hir::Crate
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
item: CrateItem<'hir>exported_macros: &'hir [MacroDef<'hir>]non_exported_macro_attrs: &'hir [Attribute]items: BTreeMap<HirId, Item<'hir>>trait_items: BTreeMap<TraitItemId, TraitItem<'hir>>impl_items: BTreeMap<ImplItemId, ImplItem<'hir>>bodies: BTreeMap<BodyId, Body<'hir>>trait_impls: BTreeMap<DefId, Vec<HirId>>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<HirId, 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: BTreeMap<HirId, Vec<TraitCandidate>>Implementations
impl<'hir> Crate<'hir>[src]
pub fn item(&self, id: HirId) -> &Item<'hir>[src]
pub fn trait_item(&self, id: TraitItemId) -> &TraitItem<'hir>[src]
pub fn impl_item(&self, id: ImplItemId) -> &ImplItem<'hir>[src]
pub fn body(&self, id: BodyId) -> &Body<'hir>[src]
impl<'_> Crate<'_>[src]
pub fn visit_all_item_likes<'hir, V>(&'hir self, visitor: &mut V) where
V: ItemLikeVisitor<'hir>, [src]
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, [src]
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> !Send for Crate<'hir>
impl<'hir> !Sync for Crate<'hir>
impl<'hir> Unpin for Crate<'hir>
impl<'hir> !UnwindSafe for Crate<'hir>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,