pub(crate) struct KeyValueBucketArray<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy>(BucketArrayPair<'k, 'v, N, CAP, C, KS, V>, PhantomData<K>);
Expand description
Concrete bucket array with parallel BucketArrayMemory
for key and value
storage
This is the basic data type used for one layer of sorting buckets.
Takes several type parameters so the narrowest possible types can be chosen for counters, keys, and values. Keys take two types: the ‘wide’ version that appears in the API and a ‘storage’ version that’s been stripped of the data redundant with its bucket position.
The validity of BucketArrayMemory
entries is ensured by the combination
of our mutable ref to the BucketArrayMemory
itself and our tracking of
bucket counts within the lifetime of that reference.
Tuple Fields§
§0: BucketArrayPair<'k, 'v, N, CAP, C, KS, V>
§1: PhantomData<K>
Implementations§
Source§impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
Sourcepub(crate) fn new(
key_mem: &'k mut BucketArrayMemory<N, CAP, KS>,
value_mem: &'v mut BucketArrayMemory<N, CAP, V>,
) -> Self
pub(crate) fn new( key_mem: &'k mut BucketArrayMemory<N, CAP, KS>, value_mem: &'v mut BucketArrayMemory<N, CAP, V>, ) -> Self
A new KeyValueBucketArray
wraps two mutable BucketArrayMemory
references and adds state to track which items are valid.
Sourcepub(crate) fn drop_key_storage(self) -> ValueBucketArray<'v, N, CAP, C, K, V>
pub(crate) fn drop_key_storage(self) -> ValueBucketArray<'v, N, CAP, C, K, V>
Keep the counts and the value memory but drop the key memory.
Returns a new ValueBucketArray
.
Trait Implementations§
Source§impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> Insert<K, V> for KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> Insert<K, V> for KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
Source§impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> KeyLookup<KS, K> for KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
impl<'k, 'v, const N: usize, const CAP: usize, C: Count, K: Key, KS: KeyStorage<K>, V: Copy> KeyLookup<KS, K> for KeyValueBucketArray<'k, 'v, N, CAP, C, K, KS, V>
Source§fn item_stored_key(&self, bucket: usize, item: usize) -> KS
fn item_stored_key(&self, bucket: usize, item: usize) -> KS
Source§fn item_full_key(&self, bucket: usize, item: usize) -> K
fn item_full_key(&self, bucket: usize, item: usize) -> K
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>
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§const NUM_BUCKETS: usize = N
const NUM_BUCKETS: usize = N
Number of buckets in the array