Struct rustc_hir::definitions::Definitions
source · [−]pub struct Definitions {
table: DefPathTable,
next_disambiguator: FxHashMap<(LocalDefId, DefPathData), u32>,
stable_crate_id: StableCrateId,
}
Expand description
The definition table containing node definitions.
It holds the DefPathTable
for LocalDefId
s/DefPath
s.
It also stores mappings to convert LocalDefId
s to/from HirId
s.
Fields
table: DefPathTable
next_disambiguator: FxHashMap<(LocalDefId, DefPathData), u32>
stable_crate_id: StableCrateId
The StableCrateId of the local crate.
Implementations
sourceimpl Definitions
impl Definitions
pub fn def_path_table(&self) -> &DefPathTable
sourcepub fn def_index_count(&self) -> usize
pub fn def_index_count(&self) -> usize
Gets the number of definitions.
pub fn def_key(&self, id: LocalDefId) -> DefKey
pub fn def_path_hash(&self, id: LocalDefId) -> DefPathHash
sourcepub fn def_path(&self, id: LocalDefId) -> DefPath
pub fn def_path(&self, id: LocalDefId) -> DefPath
Returns the path from the crate root to index
. The root
nodes are not included in the path (i.e., this will be an
empty vector for the crate root). For an inlined item, this
will be the path of the item in the external crate (but the
path will begin with the path to the external crate).
sourcepub fn new(stable_crate_id: StableCrateId) -> Definitions
pub fn new(stable_crate_id: StableCrateId) -> Definitions
Adds a root definition (no parent) and a few other reserved definitions.
sourcepub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId
pub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId
Adds a definition with a parent definition.
pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_
pub fn local_def_path_hash_to_def_id(
&self,
hash: DefPathHash,
err: &mut dyn FnMut() -> !
) -> LocalDefId
pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap
Trait Implementations
sourceimpl Clone for Definitions
impl Clone for Definitions
sourcefn clone(&self) -> Definitions
fn clone(&self) -> Definitions
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for Definitions
impl Send for Definitions
impl Sync for Definitions
impl Unpin for Definitions
impl UnwindSafe for Definitions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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: 104 bytes