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

19 lines
413 B
Rust

use crate::queries;
use std::cell::Cell;
#[ra_salsa::database(queries::GroupStruct)]
#[derive(Default)]
pub(crate) struct DatabaseImpl {
storage: ra_salsa::Storage<Self>,
counter: Cell<usize>,
}
impl queries::Counter for DatabaseImpl {
fn increment(&self) -> usize {
let v = self.counter.get();
self.counter.set(v + 1);
v
}
}
impl ra_salsa::Database for DatabaseImpl {}