Struct rustc::hir::Crate [−][src]
pub struct Crate {
pub module: Mod,
pub attrs: HirVec<Attribute>,
pub span: Span,
pub exported_macros: HirVec<MacroDef>,
pub items: BTreeMap<NodeId, Item>,
pub trait_items: BTreeMap<TraitItemId, TraitItem>,
pub impl_items: BTreeMap<ImplItemId, ImplItem>,
pub bodies: BTreeMap<BodyId, Body>,
pub trait_impls: BTreeMap<DefId, Vec<NodeId>>,
pub trait_auto_impl: BTreeMap<DefId, NodeId>,
pub body_ids: Vec<BodyId>,
}🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The top-level data structure that stores the entire contents of the crate currently being compiled.
For more details, see the rustc guide.
Fields
module: Mod
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
attrs: HirVec<Attribute>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
span: Span
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
exported_macros: HirVec<MacroDef>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
items: BTreeMap<NodeId, Item>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
trait_items: BTreeMap<TraitItemId, TraitItem>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl_items: BTreeMap<ImplItemId, ImplItem>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
bodies: BTreeMap<BodyId, Body>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
trait_impls: BTreeMap<DefId, Vec<NodeId>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
trait_auto_impl: BTreeMap<DefId, NodeId>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
body_ids: Vec<BodyId>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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.
Methods
impl Crate[src]
impl Cratepub fn item(&self, id: NodeId) -> &Item[src]
pub fn item(&self, id: NodeId) -> &Item🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn trait_item(&self, id: TraitItemId) -> &TraitItem[src]
pub fn trait_item(&self, id: TraitItemId) -> &TraitItem🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn impl_item(&self, id: ImplItemId) -> &ImplItem[src]
pub fn impl_item(&self, id: ImplItemId) -> &ImplItem🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn visit_all_item_likes<'hir, V>(&'hir self, visitor: &mut V) where
V: ItemLikeVisitor<'hir>, [src]
pub fn visit_all_item_likes<'hir, V>(&'hir self, visitor: &mut V) where
V: ItemLikeVisitor<'hir>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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]
pub fn par_visit_all_item_likes<'hir, V>(&'hir self, visitor: &V) where
V: ParItemLikeVisitor<'hir> + Sync + Send, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A parallel version of visit_all_item_likes
pub fn body(&self, id: BodyId) -> &Body[src]
pub fn body(&self, id: BodyId) -> &Body🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Trait Implementations
impl PpAnn for Crate[src]
impl PpAnn for Cratefn try_fetch_item(&self, item: NodeId) -> Option<&Item>[src]
fn try_fetch_item(&self, item: NodeId) -> Option<&Item>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn nested(&self, state: &mut State, nested: Nested) -> Result<()>[src]
fn nested(&self, state: &mut State, nested: Nested) -> Result<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn pre(&self, _state: &mut State, _node: AnnNode) -> Result<()>[src]
fn pre(&self, _state: &mut State, _node: AnnNode) -> Result<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn post(&self, _state: &mut State, _node: AnnNode) -> Result<()>[src]
fn post(&self, _state: &mut State, _node: AnnNode) -> Result<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Clone for Crate[src]
impl Clone for Cratefn clone(&self) -> Crate[src]
fn clone(&self) -> CrateReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for Crate[src]
impl PartialEq for Cratefn eq(&self, other: &Crate) -> bool[src]
fn eq(&self, other: &Crate) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Crate) -> bool[src]
fn ne(&self, other: &Crate) -> boolThis method tests for !=.
impl Eq for Crate[src]
impl Eq for Cratefn assert_receiver_is_total_eq(&self)[src]
fn assert_receiver_is_total_eq(&self)impl Encodable for Crate[src]
impl Encodable for Cratefn encode<__S: Encoder>(&self, s: &mut __S) -> Result<(), __S::Error>[src]
fn encode<__S: Encoder>(&self, s: &mut __S) -> Result<(), __S::Error>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Decodable for Crate[src]
impl Decodable for Cratefn decode<__D: Decoder>(d: &mut __D) -> Result<Crate, __D::Error>[src]
fn decode<__D: Decoder>(d: &mut __D) -> Result<Crate, __D::Error>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Debug for Crate[src]
impl Debug for Crate