pub struct Buckets { /* private fields */ }Expand description
Buckets is a fast, space-efficient array of buckets where each bucket can store up to a configured maximum value.
Implementations§
Source§impl Buckets
impl Buckets
Sourcepub fn new(count: usize, bucket_size: u8) -> Self
pub fn new(count: usize, bucket_size: u8) -> Self
Creates a new Buckets with the provided number of buckets where each bucket is the specified number of bits.
Sourcepub fn max_bucket_value(&self) -> u8
pub fn max_bucket_value(&self) -> u8
Returns the maximum value that can be stored in a bucket.
Sourcepub fn decrease(&mut self, bucket: usize, delta: u8) -> &Self
pub fn decrease(&mut self, bucket: usize, delta: u8) -> &Self
Decrease the value in the specified bucket by the provided delta. The value is clamped to zero and the maximum bucket value. Returns itself to allow for chaining.
Sourcepub fn increment(&mut self, bucket: usize, delta: u8) -> &Self
pub fn increment(&mut self, bucket: usize, delta: u8) -> &Self
Increment the value in the specified bucket by the provided delta. The value is clamped to zero and the maximum bucket value. Returns itself to allow for chaining.
Auto Trait Implementations§
impl Freeze for Buckets
impl RefUnwindSafe for Buckets
impl Send for Buckets
impl Sync for Buckets
impl Unpin for Buckets
impl UnwindSafe for Buckets
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