Struct rustc_hir::definitions::Definitions
source · pub struct Definitions {
table: DefPathTable,
next_disambiguator: UnordMap<(LocalDefId, DefPathData), u32>,
}
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: UnordMap<(LocalDefId, DefPathData), u32>
Implementations§
source§impl 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.
sourcepub fn local_def_path_hash_to_def_id(
&self,
hash: DefPathHash,
) -> Option<LocalDefId>
pub fn local_def_path_hash_to_def_id( &self, hash: DefPathHash, ) -> Option<LocalDefId>
Returns None
if the DefPathHash
does not correspond to a LocalDefId
in the current compilation session. This can legitimately happen if the
DefPathHash
is from a DefId
in an upstream crate or, during incr. comp.,
if the DefPathHash
is from a previous compilation session and
the def-path does not exist anymore.
pub fn def_path_hash_to_def_index_map(&self) -> &DefPathHashMap
pub fn num_definitions(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Definitions
impl RefUnwindSafe for Definitions
impl Send for Definitions
impl Sync for Definitions
impl Unpin for Definitions
impl UnwindSafe for Definitions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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