diff options
Diffstat (limited to 'crates/ra_batch/src')
-rw-r--r-- | crates/ra_batch/src/lib.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs new file mode 100644 index 000000000..25f1f7357 --- /dev/null +++ b/crates/ra_batch/src/lib.rs | |||
@@ -0,0 +1,30 @@ | |||
1 | use std::sync::Arc; | ||
2 | |||
3 | use ra_db::{ | ||
4 | FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, SourceDatabase, salsa, | ||
5 | }; | ||
6 | use ra_hir::{db, HirInterner}; | ||
7 | |||
8 | #[salsa::database( | ||
9 | ra_db::SourceDatabaseStorage, | ||
10 | db::HirDatabaseStorage, | ||
11 | db::PersistentHirDatabaseStorage | ||
12 | )] | ||
13 | #[derive(Debug)] | ||
14 | pub(crate) struct BatchDatabase { | ||
15 | runtime: salsa::Runtime<BatchDatabase>, | ||
16 | interner: Arc<HirInterner>, | ||
17 | file_counter: u32, | ||
18 | } | ||
19 | |||
20 | impl salsa::Database for BatchDatabase { | ||
21 | fn salsa_runtime(&self) -> &salsa::Runtime<BatchDatabase> { | ||
22 | &self.runtime | ||
23 | } | ||
24 | } | ||
25 | |||
26 | impl AsRef<HirInterner> for BatchDatabase { | ||
27 | fn as_ref(&self) -> &HirInterner { | ||
28 | &self.interner | ||
29 | } | ||
30 | } | ||