rust-analyzer/crates/ra-salsa/tests/storage_varieties/implementation.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
413 B
Rust
Raw Normal View History

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