Struct ValueBucketArray

Source
pub(crate) struct ValueBucketArray<'v, const N: usize, const CAP: usize, C: Count, K: Key, V: Copy>(BucketArray<'v, N, CAP, C, V>, PhantomData<K>);
Expand description

Concrete bucket array with a single BucketArrayMemory for value storage

Keys are used for bucket indexing but the remainder bits are not stored.

Tuple Fields§

§0: BucketArray<'v, N, CAP, C, V>§1: PhantomData<K>

Implementations§

Source§

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

Source

pub(crate) fn new(value_mem: &'v mut BucketArrayMemory<N, CAP, V>) -> Self

A new ValueBucketArray wraps one mutable BucketArrayMemory reference and adds a counts array to track which items are valid.

Trait Implementations§

Source§

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

Source§

fn insert(&mut self, key: K, value: V) -> Result<(), ()>

Append a new item to its sorting bucket, or return Err(()) if it’s full
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>

Source§

const NUM_BUCKETS: usize = N

Number of buckets in the array

Source§

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

Get the range of items within a single bucket.
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.
Source§

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

Source§

fn item_value(&self, bucket: usize, item: usize) -> V

Retrieve the Value for a particular item

Auto Trait Implementations§

§

impl<'v, const N: usize, const CAP: usize, C, K, V> Freeze for ValueBucketArray<'v, N, CAP, C, K, V>
where C: Freeze,

§

impl<'v, const N: usize, const CAP: usize, C, K, V> RefUnwindSafe for ValueBucketArray<'v, N, CAP, C, K, V>

§

impl<'v, const N: usize, const CAP: usize, C, K, V> Send for ValueBucketArray<'v, N, CAP, C, K, V>
where K: Send, C: Send, V: Send,

§

impl<'v, const N: usize, const CAP: usize, C, K, V> Sync for ValueBucketArray<'v, N, CAP, C, K, V>
where K: Sync, C: Sync, V: Sync,

§

impl<'v, const N: usize, const CAP: usize, C, K, V> Unpin for ValueBucketArray<'v, N, CAP, C, K, V>
where K: Unpin, C: Unpin,

§

impl<'v, const N: usize, const CAP: usize, C, K, V> !UnwindSafe for ValueBucketArray<'v, N, CAP, C, K, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.