2018-09-29 08:50:08 +00:00
|
|
|
use crate::queries;
|
|
|
|
use std::cell::Cell;
|
|
|
|
|
2019-01-25 15:25:17 +00:00
|
|
|
#[salsa::database(queries::GroupStruct)]
|
2018-09-29 08:50:08 +00:00
|
|
|
#[derive(Default)]
|
2019-01-23 02:53:06 +00:00
|
|
|
pub(crate) struct DatabaseImpl {
|
2020-07-02 10:31:02 +00:00
|
|
|
storage: salsa::Storage<Self>,
|
2018-09-29 08:50:08 +00:00
|
|
|
counter: Cell<usize>,
|
|
|
|
}
|
|
|
|
|
2018-10-05 08:54:51 +00:00
|
|
|
impl queries::Counter for DatabaseImpl {
|
2018-09-29 08:50:08 +00:00
|
|
|
fn increment(&self) -> usize {
|
|
|
|
let v = self.counter.get();
|
|
|
|
self.counter.set(v + 1);
|
|
|
|
v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-02 10:31:02 +00:00
|
|
|
impl salsa::Database for DatabaseImpl {}
|