Skip to main content

ToStableHashKey

Trait ToStableHashKey 

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

    // Required method
    fn to_stable_hash_key(&self, hcx: &mut 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: &mut 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: &mut Hcx) -> Self::KeyType

Implementors§