pub struct PowerOfTwo<const FACTOR: usize = 2> { /* private fields */ }Expand description
Grow by a power-of-two factor and map with a mask.
FACTOR must be a power of two and at least 2. The default is 2.
Trait Implementations§
Source§impl<const FACTOR: usize> Clone for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> Clone for PowerOfTwo<FACTOR>
Source§fn clone(&self) -> PowerOfTwo<FACTOR>
fn clone(&self) -> PowerOfTwo<FACTOR>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const FACTOR: usize> GrowthPolicy for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> GrowthPolicy for PowerOfTwo<FACTOR>
Source§fn new(min_bucket_count: usize) -> Result<(Self, usize), LengthError>
fn new(min_bucket_count: usize) -> Result<(Self, usize), LengthError>
Build a policy for at least
min_bucket_count buckets. Read moreSource§fn bucket_for_hash(&self, hash: usize) -> usize
fn bucket_for_hash(&self, hash: usize) -> usize
Map
hash to a bucket in [0, bucket_count).Source§fn next_bucket_count(&self) -> Result<usize, LengthError>
fn next_bucket_count(&self) -> Result<usize, LengthError>
The bucket count to use on the next growth. Read more
Source§fn max_bucket_count(&self) -> usize
fn max_bucket_count(&self) -> usize
The largest bucket count the policy can represent.
Source§fn is_power_of_two() -> bool
fn is_power_of_two() -> bool
Whether this policy keeps the bucket count a power of two. Read more
Auto Trait Implementations§
impl<const FACTOR: usize> Freeze for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> RefUnwindSafe for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> Send for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> Sync for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> Unpin for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> UnsafeUnpin for PowerOfTwo<FACTOR>
impl<const FACTOR: usize> UnwindSafe for PowerOfTwo<FACTOR>
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
Mutably borrows from an owned value. Read more