Trait ToStableHashKey

Source
pub trait ToStableHashKey<HCX> {
    type KeyType: Ord + Sized + HashStable<HCX>;

    // Required method
    fn to_stable_hash_key(&self, hcx: &HCX) -> Self::KeyType;
}
Expand description

Implement this for types that can be turned into stable keys like, for example, for DefId that can be converted to a DefPathHash. This is used for bringing maps into a predictable order before hashing them.

Required Associated Types§

Required Methods§

Source

fn to_stable_hash_key(&self, hcx: &HCX) -> Self::KeyType

Implementations on Foreign Types§

Source§

impl<HCX> ToStableHashKey<HCX> for String

Source§

impl<HCX, T1: ToStableHashKey<HCX>, T2: ToStableHashKey<HCX>> ToStableHashKey<HCX> for (T1, T2)

Source§

type KeyType = (<T1 as ToStableHashKey<HCX>>::KeyType, <T2 as ToStableHashKey<HCX>>::KeyType)

Source§

fn to_stable_hash_key(&self, hcx: &HCX) -> Self::KeyType

Implementors§

impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for BodyId

impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for ImplItemId

impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for ItemId

impl<HirCtx: HashStableContext> ToStableHashKey<HirCtx> for HirId

impl<HCX> ToStableHashKey<HCX> for LintId

impl<HCX: HashStableContext> ToStableHashKey<HCX> for LintExpectationId

impl<'a, 'tcx, H, T> ToStableHashKey<StableHashingContext<'a>> for &'tcx RawList<H, T>

impl<HCX> ToStableHashKey<HCX> for WorkProductId

impl<CTX> ToStableHashKey<CTX> for Symbol

impl<HCX: Clone, DefId: HashStable<HCX>> ToStableHashKey<HCX> for SimplifiedType<DefId>