Skip to main content

HashTraits

Trait HashTraits 

Source
pub trait HashTraits<K: ?Sized> {
    // Required method
    fn get_hash(key: &K) -> usize;
}
Expand description

Traits defining the hash function used by a HashTable to select a bucket for a key.

get_hash may return any usize; the hash table reduces it modulo its bucket count to determine the index of the bucket the key belongs in.

Required Methods§

Source

fn get_hash(key: &K) -> usize

Returns the hash value of key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§