#[repr(usize)]enum BucketIndex {
Show 21 variants
Bucket00 = 0,
Bucket01 = 1,
Bucket02 = 2,
Bucket03 = 3,
Bucket04 = 4,
Bucket05 = 5,
Bucket06 = 6,
Bucket07 = 7,
Bucket08 = 8,
Bucket09 = 9,
Bucket10 = 10,
Bucket11 = 11,
Bucket12 = 12,
Bucket13 = 13,
Bucket14 = 14,
Bucket15 = 15,
Bucket16 = 16,
Bucket17 = 17,
Bucket18 = 18,
Bucket19 = 19,
Bucket20 = 20,
}Expand description
Index into an array of buckets.
Using an enum lets us tell the compiler that values range from 0 to 20, allowing array bounds checks to be optimized away, without having to resort to pattern types or other unstable features.
Variants§
Bucket00 = 0
Bucket01 = 1
Bucket02 = 2
Bucket03 = 3
Bucket04 = 4
Bucket05 = 5
Bucket06 = 6
Bucket07 = 7
Bucket08 = 8
Bucket09 = 9
Bucket10 = 10
Bucket11 = 11
Bucket12 = 12
Bucket13 = 13
Bucket14 = 14
Bucket15 = 15
Bucket16 = 16
Bucket17 = 17
Bucket18 = 18
Bucket19 = 19
Bucket20 = 20
Implementations§
Source§impl BucketIndex
impl BucketIndex
Sourceconst BUCKET_0_CAPACITY: usize
const BUCKET_0_CAPACITY: usize
Capacity of bucket 0 (and also of bucket 1).
Sourceconst NONZERO_BUCKET_SHIFT_ADJUST: usize = 11
const NONZERO_BUCKET_SHIFT_ADJUST: usize = 11
Adjustment factor from the highest-set-bit-position of a flat index, to its corresponding bucket number.
For example, the first flat-index in bucket 2 is 8192.
Its highest-set-bit-position is (8192).ilog2() == 13, and subtracting
the adjustment factor of 11 gives the bucket number of 2.
const fn to_usize(self) -> usize
const fn from_raw(raw: usize) -> Self
Sourceconst fn from_flat_index(flat: usize) -> (Self, usize)
const fn from_flat_index(flat: usize) -> (Self, usize)
Converts a flat index in the range 0..=u32::MAX into a bucket index,
and a slot offset within that bucket.
Panics if flat > u32::MAX.
fn iter_all() -> impl ExactSizeIterator<Item = Self>
fn enumerate_buckets<T>( buckets: &[T; 21], ) -> impl ExactSizeIterator<Item = (Self, &T)>
Trait Implementations§
Source§impl Clone for BucketIndex
impl Clone for BucketIndex
Source§fn clone(&self) -> BucketIndex
fn clone(&self) -> BucketIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BucketIndex
impl Debug for BucketIndex
Source§impl<T> Index<BucketIndex> for [T; 21]
impl<T> Index<BucketIndex> for [T; 21]
Source§impl<T> IndexMut<BucketIndex> for [T; 21]
impl<T> IndexMut<BucketIndex> for [T; 21]
Source§impl PartialEq for BucketIndex
impl PartialEq for BucketIndex
impl Copy for BucketIndex
impl Eq for BucketIndex
impl StructuralPartialEq for BucketIndex
Auto Trait Implementations§
impl DynSend for BucketIndex
impl DynSync for BucketIndex
impl Freeze for BucketIndex
impl RefUnwindSafe for BucketIndex
impl Send for BucketIndex
impl Sync for BucketIndex
impl Unpin for BucketIndex
impl UnsafeUnpin for BucketIndex
impl UnwindSafe for BucketIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes
Size for each variant:
Bucket00: 0 bytesBucket01: 0 bytesBucket02: 0 bytesBucket03: 0 bytesBucket04: 0 bytesBucket05: 0 bytesBucket06: 0 bytesBucket07: 0 bytesBucket08: 0 bytesBucket09: 0 bytesBucket10: 0 bytesBucket11: 0 bytesBucket12: 0 bytesBucket13: 0 bytesBucket14: 0 bytesBucket15: 0 bytesBucket16: 0 bytesBucket17: 0 bytesBucket18: 0 bytesBucket19: 0 bytesBucket20: 0 bytes