salsa/tests/storage_varieties/implementation.rs

20 lines
404 B
Rust
Raw Normal View History

2018-09-29 08:50:08 +00:00
use crate::queries;
use std::cell::Cell;
#[salsa::database(queries::GroupStruct)]
2018-09-29 08:50:08 +00:00
#[derive(Default)]
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 {}