Trait Key

Source
pub(crate) trait Key:
    Copy
    + Zero
    + One
    + PartialEq<Self>
    + TryFrom<usize>
    + TryInto<usize>
    + Shl<usize, Output = Self>
    + Shr<usize, Output = Self>
    + Div<Self, Output = Self>
    + Rem<Self, Output = Self>
    + Mul<Self, Output = Self>
    + Not
    + Sub<Self, Output = Self>
    + BitAnd<Self, Output = Self>
    + WrappingAdd
    + WrappingNeg {
    // Provided methods
    fn from_bucket_index(i: usize) -> Self { ... }
    fn into_bucket_index(self) -> usize { ... }
    fn low_bits_are_zero(self, num_bits: usize) -> bool { ... }
}
Expand description

Types we can use as full width keys

Provided Methods§

Source

fn from_bucket_index(i: usize) -> Self

Build a Key from a bucket index.

Panics if the index is out of range.

Source

fn into_bucket_index(self) -> usize

Convert this Key back into a bucket index.

Panics if the value would not fit in a usize. No other range checking on the bucket index is enforced here.

Source

fn low_bits_are_zero(self, num_bits: usize) -> bool

Check if the N low bits of the key are zero.

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<T: Copy + Zero + One + PartialEq<Self> + TryFrom<usize> + TryInto<usize> + Shl<usize, Output = Self> + Shr<usize, Output = Self> + Div<Self, Output = Self> + Rem<Self, Output = Self> + Mul<Self, Output = Self> + Not + Sub<Self, Output = Self> + BitAnd<Self, Output = Self> + WrappingAdd + WrappingNeg> Key for T