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
sourceimpl 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
sourceimpl From<LocalDefId> for DefId
impl From<LocalDefId> for DefId
sourcefn from(local: LocalDefId) -> DefId
fn from(local: LocalDefId) -> DefId
Converts to this type from the input type.
sourceimpl<CTX: HashStableContext> HashStable<CTX> for DefId
impl<CTX: HashStableContext> HashStable<CTX> for DefId
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
sourceimpl Ord for DefId
impl Ord for DefId
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<DefId> for DefId
impl PartialOrd<DefId> for DefId
sourcefn partial_cmp(&self, other: &DefId) -> Option<Ordering>
fn partial_cmp(&self, other: &DefId) -> Option<Ordering>
1.0.0 · sourcefn 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 moresourceimpl<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
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
Mutably borrows from an owned value. Read more
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