diff options
Diffstat (limited to 'crates/ra_batch')
-rw-r--r-- | crates/ra_batch/Cargo.toml | 24 | ||||
-rw-r--r-- | crates/ra_batch/src/lib.rs | 30 |
2 files changed, 54 insertions, 0 deletions
diff --git a/crates/ra_batch/Cargo.toml b/crates/ra_batch/Cargo.toml new file mode 100644 index 000000000..3e83f8388 --- /dev/null +++ b/crates/ra_batch/Cargo.toml | |||
@@ -0,0 +1,24 @@ | |||
1 | [package] | ||
2 | edition = "2018" | ||
3 | name = "ra_batch" | ||
4 | version = "0.1.0" | ||
5 | authors = ["Aleksey Kladov <[email protected]>"] | ||
6 | |||
7 | [dependencies] | ||
8 | itertools = "0.8.0" | ||
9 | join_to_string = "0.1.3" | ||
10 | log = "0.4.5" | ||
11 | relative-path = "0.4.0" | ||
12 | rayon = "1.0.2" | ||
13 | fst = "0.3.1" | ||
14 | rustc-hash = "1.0" | ||
15 | parking_lot = "0.7.0" | ||
16 | unicase = "2.2.0" | ||
17 | |||
18 | ra_syntax = { path = "../ra_syntax" } | ||
19 | ra_db = { path = "../ra_db" } | ||
20 | ra_hir = { path = "../ra_hir" } | ||
21 | |||
22 | [dev-dependencies] | ||
23 | test_utils = { path = "../test_utils" } | ||
24 | insta = "0.6.1" | ||
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 | } | ||