Bucketize

Trait Bucketize 

Source
pub trait Bucketize: Hash {
    // Provided methods
    fn bucket(&self) -> usize { ... }
    fn bucket_range<const N: usize>(&self) -> usize { ... }
}
Expand description

Defines into which bucket a key falls. The default implementation uses the Hash trait for this. Custom implementations can override this to something more simple. It is recommended to implement this because very good distribution of the resulting value is not as important as for the hashmap.

Provided Methods§

Source

fn bucket(&self) -> usize

Must generate a trivial hash.

Source

fn bucket_range<const N: usize>(&self) -> usize

Must return an value 0..N-1

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.

Implementors§