mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-13 00:40:22 +00:00
15 lines
230 B
Rust
15 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
|
||
|
}
|
||
|
}
|