add handy helper for Cell<usize>, used for perf stats

This commit is contained in:
Niko Matsakis 2018-02-20 10:36:29 -05:00
parent 652b3b71f3
commit 1d377d10a1

View file

@ -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);
}
}