mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 16:35:21 +00:00
2d2bdfe7f1
They aren't meant to be things to model oneself after.
14 lines
230 B
Rust
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
|
|
}
|
|
}
|