add handy helper for Cell<usize>, used for perf stats
This commit is contained in:
parent
652b3b71f3
commit
1d377d10a1
1 changed files with 10 additions and 0 deletions
|
@ -373,3 +373,13 @@ fn test_to_readable_str() {
|
|||
assert_eq!("1_000_000", to_readable_str(1_000_000));
|
||||
assert_eq!("1_234_567", to_readable_str(1_234_567));
|
||||
}
|
||||
|
||||
pub trait CellUsizeExt {
|
||||
fn increment(&self);
|
||||
}
|
||||
|
||||
impl CellUsizeExt for Cell<usize> {
|
||||
fn increment(&self) {
|
||||
self.set(self.get() + 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue