mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
19 lines
404 B
Rust
19 lines
404 B
Rust
use crate::queries;
|
|
use std::cell::Cell;
|
|
|
|
#[salsa::database(queries::GroupStruct)]
|
|
#[derive(Default)]
|
|
pub(crate) struct DatabaseImpl {
|
|
storage: 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 salsa::Database for DatabaseImpl {}
|