pub struct SharedCounter { /* private fields */ }Expand description
A thread-safe atomic counter.
Implementations§
Sourcepub fn with_value(value: u64) -> Self
pub fn with_value(value: u64) -> Self
Create a counter with an initial value.
Sourcepub fn increment_by(&self, n: u64) -> u64
pub fn increment_by(&self, n: u64) -> u64
Increment by n and return the new value.
Wrap in Arc for shared access across tasks.
Trait Implementations§
Auto Trait Implementations§
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