salsa/tests/incremental/counter.rs
Niko Matsakis 2d2bdfe7f1 move incremental, storage_varieties to tests
They aren't meant to be things to model oneself after.
2018-09-30 07:01:21 -04:00

14 lines
230 B
Rust

use std::cell::Cell;
#[derive(Default)]
crate struct Counter {
value: Cell<usize>,
}
impl Counter {
crate fn increment(&self) -> usize {
let v = self.value.get();
self.value.set(v + 1);
v
}
}