rust-analyzer/crates/ra-salsa/tests/incremental/counter.rs
2024-10-14 10:09:22 -04:00

14 lines
240 B
Rust

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