pub struct CounterManager { /* private fields */ }Expand description
Counter manager for different storage modes.
Implementations§
Source§impl CounterManager
impl CounterManager
Sourcepub fn new(mode: CounterMode) -> Self
pub fn new(mode: CounterMode) -> Self
Create a new counter manager.
Sourcepub fn with_in_bin_value(mode: CounterMode, initial_value: u64) -> Self
pub fn with_in_bin_value(mode: CounterMode, initial_value: u64) -> Self
Create a counter manager with an initial in-bin value.
Sourcepub fn mode(&self) -> &CounterMode
pub fn mode(&self) -> &CounterMode
Get the counter mode.
Sourcepub fn reserve(&mut self, count: u64) -> Result<u64>
pub fn reserve(&mut self, count: u64) -> Result<u64>
Increment counter and return the starting value for a batch.
For a batch of count codes, returns the starting counter value
and increments the stored counter by count.
Sourcepub fn set(&mut self, value: u64) -> Result<()>
pub fn set(&mut self, value: u64) -> Result<()>
Set the counter value (for initialization or reset).
Sourcepub fn is_in_bin_modified(&self) -> bool
pub fn is_in_bin_modified(&self) -> bool
Check if the in-bin counter has been modified.
Sourcepub fn in_bin_value(&self) -> u64
pub fn in_bin_value(&self) -> u64
Get the in-bin counter value.
Sourcepub fn mark_saved(&mut self)
pub fn mark_saved(&mut self)
Mark the in-bin counter as saved.
Sourcepub fn set_mode(&mut self, mode: CounterMode)
pub fn set_mode(&mut self, mode: CounterMode)
Update the counter mode.
Auto Trait Implementations§
impl Freeze for CounterManager
impl RefUnwindSafe for CounterManager
impl Send for CounterManager
impl Sync for CounterManager
impl Unpin for CounterManager
impl UnwindSafe for CounterManager
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