Trait Shape

Source
pub(crate) trait Shape<K: Key> {
    const NUM_BUCKETS: usize;

    // Required method
    fn item_range(&self, bucket: usize) -> Range<usize>;

    // Provided methods
    fn divisor(&self) -> K { ... }
    fn split_wide_key(&self, key: K) -> (usize, K) { ... }
    fn join_wide_key(&self, bucket: usize, remainder: K) -> K { ... }
}
Expand description

Trait for accessing the overall shape of a bucket array

Required Associated Constants§

Source

const NUM_BUCKETS: usize

The number of buckets in this array

Required Methods§

Source

fn item_range(&self, bucket: usize) -> Range<usize>

Get the range of items within a single bucket.

Provided Methods§

Source

fn divisor(&self) -> K

Get the key divisor: the number of buckets but as a Key instance.

Source

fn split_wide_key(&self, key: K) -> (usize, K)

Split a wide key into the bucket index and the remaining bits.

Source

fn join_wide_key(&self, bucket: usize, remainder: K) -> K

Rebuild a wide key from its split components.

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§

Source§

impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> Shape<K> for KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>

Source§

impl<'v, const N: usize, const CAP: usize, C: Count, K: Key, V: Copy> Shape<K> for ValueBucketArray<'v, N, CAP, C, K, V>