Skip to main content

ToStableHashKey

Trait ToStableHashKey 

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

    // Required method
    fn to_stable_hash_key<Hcx: HashStableContext>(
        &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§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToStableHashKey for String

Source§

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

Implementors§