Struct rustc_span::def_id::DefId
source · Expand description
A DefId
identifies a particular definition, by combining a crate
index and a def index.
You can create a DefId
from a LocalDefId
using local_def_id.to_def_id()
.
Fields§
§index: DefIndex
§krate: CrateNum
Implementations§
source§impl DefId
impl DefId
sourcepub fn is_local(self) -> bool
pub fn is_local(self) -> bool
Returns whether the item is defined in the crate currently being compiled.
pub fn as_local(self) -> Option<LocalDefId>
pub fn expect_local(self) -> LocalDefId
pub fn is_crate_root(self) -> bool
pub fn as_crate_root(self) -> Option<CrateNum>
pub fn is_top_level_module(self) -> bool
Trait Implementations§
source§impl From<LocalDefId> for DefId
impl From<LocalDefId> for DefId
source§fn from(local: LocalDefId) -> DefId
fn from(local: LocalDefId) -> DefId
Converts to this type from the input type.
source§impl<CTX: HashStableContext> HashStable<CTX> for DefId
impl<CTX: HashStableContext> HashStable<CTX> for DefId
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
source§impl Ord for DefId
impl Ord for DefId
source§impl PartialOrd<DefId> for DefId
impl PartialOrd<DefId> for DefId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<CTX: HashStableContext> ToStableHashKey<CTX> for DefId
impl<CTX: HashStableContext> ToStableHashKey<CTX> for DefId
type KeyType = DefPathHash
fn to_stable_hash_key(&self, hcx: &CTX) -> DefPathHash
impl Copy for DefId
impl Eq for DefId
impl StructuralEq for DefId
impl StructuralPartialEq for DefId
Auto Trait Implementations§
impl RefUnwindSafe for DefId
impl Send for DefId
impl Sync for DefId
impl Unpin for DefId
impl UnwindSafe for DefId
Blanket Implementations§
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: 8 bytes