pub struct Mod<const NUM: usize = 3, const DEN: usize = 2> { /* private fields */ }Expand description
Grow by the rational factor NUM / DEN and map with a modulo.
The factor must be at least 1.1. The default is 3/2.
Trait Implementations§
Source§impl<const NUM: usize, const DEN: usize> GrowthPolicy for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> GrowthPolicy for Mod<NUM, DEN>
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 NUM: usize, const DEN: usize> Freeze for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> RefUnwindSafe for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> Send for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> Sync for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> Unpin for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> UnsafeUnpin for Mod<NUM, DEN>
impl<const NUM: usize, const DEN: usize> UnwindSafe for Mod<NUM, DEN>
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