Struct rustc_span::def_id::LocalDefId
source · pub struct LocalDefId {
pub local_def_index: DefIndex,
}
Expand description
A LocalDefId
is equivalent to a DefId
with krate == LOCAL_CRATE
. Since
we encode this information in the type, we can ensure at compile time that
no DefId
s from upstream crates get thrown into the mix. There are quite a
few cases where we know that only DefId
s from the local crate are expected;
a DefId
from a different crate would signify a bug somewhere. This
is when LocalDefId
comes in handy.
Fields§
§local_def_index: DefIndex
Implementations§
source§impl LocalDefId
impl LocalDefId
Trait Implementations§
source§impl Clone for LocalDefId
impl Clone for LocalDefId
source§fn clone(&self) -> LocalDefId
fn clone(&self) -> LocalDefId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LocalDefId
impl Debug for LocalDefId
source§impl<D: Decoder> Decodable<D> for LocalDefId
impl<D: Decoder> Decodable<D> for LocalDefId
fn decode(d: &mut D) -> LocalDefId
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 Hash for LocalDefId
impl Hash for LocalDefId
source§impl<CTX: HashStableContext> HashStable<CTX> for LocalDefId
impl<CTX: HashStableContext> HashStable<CTX> for LocalDefId
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
source§impl Idx for LocalDefId
impl Idx for LocalDefId
source§impl !Ord for LocalDefId
impl !Ord for LocalDefId
source§impl PartialEq<LocalDefId> for LocalDefId
impl PartialEq<LocalDefId> for LocalDefId
source§fn eq(&self, other: &LocalDefId) -> bool
fn eq(&self, other: &LocalDefId) -> bool
source§impl !PartialOrd<LocalDefId> for LocalDefId
impl !PartialOrd<LocalDefId> for LocalDefId
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 LocalDefId
impl<CTX: HashStableContext> ToStableHashKey<CTX> for LocalDefId
type KeyType = DefPathHash
fn to_stable_hash_key(&self, hcx: &CTX) -> DefPathHash
impl Copy for LocalDefId
impl Eq for LocalDefId
impl StructuralEq for LocalDefId
impl StructuralPartialEq for LocalDefId
Auto Trait Implementations§
impl RefUnwindSafe for LocalDefId
impl Send for LocalDefId
impl Sync for LocalDefId
impl Unpin for LocalDefId
impl UnwindSafe for LocalDefId
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: 4 bytes