Skip to main content

DefaultHashable

Trait DefaultHashable 

Source
pub trait DefaultHashable {
    // Required method
    fn hash_key(&self) -> usize;
}
Expand description

Key types which can be hashed by DefaultHashTraits.

This is the Rust analog of the static GetHash method which C++’s fbl::DefaultHashTraits requires. Implementations should return what amounts to a “large number”; the hash table takes it modulo its bucket count to determine the bucket index.

This trait is implemented for all primitive integer types, returning the value of the integer itself (converted with as usize).

Required Methods§

Source

fn hash_key(&self) -> usize

Returns the (unreduced) hash value of this key.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl DefaultHashable for i8

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for i16

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for i32

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for i64

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for isize

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for u8

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for u16

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for u32

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for u64

Source§

fn hash_key(&self) -> usize

Source§

impl DefaultHashable for usize

Source§

fn hash_key(&self) -> usize

Implementors§