Struct rustc_hir::hir_id::HirId [−][src]
pub struct HirId {
pub owner: LocalDefId,
pub local_id: ItemLocalId,
}Expand description
Uniquely identifies a node in the HIR of the current crate. It is
composed of the owner, which is the LocalDefId of the directly enclosing
hir::Item, hir::TraitItem, or hir::ImplItem (i.e., the closest “item-like”),
and the local_id which is unique within the given owner.
This two-level structure makes for more stable values: One can move an item
around within the source code, or add or remove stuff before it, without
the local_id part of the HirId changing, which is a very useful property in
incremental compilation where we have to persist things through changes to
the code base.
Fields
owner: LocalDefIdlocal_id: ItemLocalIdImplementations
impl HirId[src]
impl HirId[src]pub fn expect_owner(self) -> LocalDefId[src]
pub fn as_owner(self) -> Option<LocalDefId>[src]
pub fn make_owner(owner: LocalDefId) -> Self[src]
Trait Implementations
impl<HirCtx: HashStableContext> HashStable<HirCtx> for HirId[src]
impl<HirCtx: HashStableContext> HashStable<HirCtx> for HirId[src]fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher)[src]
impl Ord for HirId[src]
impl Ord for HirId[src]impl PartialOrd<HirId> for HirId[src]
impl PartialOrd<HirId> for HirId[src]fn partial_cmp(&self, other: &HirId) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &HirId) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for HirId[src]
impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for HirId[src]type KeyType = (DefPathHash, ItemLocalId)
fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId)[src]
impl Copy for HirId[src]
impl Eq for HirId[src]
impl StructuralEq for HirId[src]
impl StructuralPartialEq for HirId[src]
Auto Trait Implementations
impl RefUnwindSafe for HirId
impl Send for HirId
impl Sync for HirId
impl Unpin for HirId
impl UnwindSafe for HirId
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more