diff options
-rw-r--r-- | Cargo.lock | 20 | ||||
-rw-r--r-- | crates/ra_batch/Cargo.toml | 24 | ||||
-rw-r--r-- | crates/ra_batch/src/lib.rs | 30 |
3 files changed, 74 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock index 0009cdaab..53c2498f1 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -910,6 +910,26 @@ dependencies = [ | |||
910 | ] | 910 | ] |
911 | 911 | ||
912 | [[package]] | 912 | [[package]] |
913 | name = "ra_batch" | ||
914 | version = "0.1.0" | ||
915 | dependencies = [ | ||
916 | "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
917 | "insta 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
918 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
919 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
920 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
921 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
922 | "ra_db 0.1.0", | ||
923 | "ra_hir 0.1.0", | ||
924 | "ra_syntax 0.1.0", | ||
925 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
926 | "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
927 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
928 | "test_utils 0.1.0", | ||
929 | "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
930 | ] | ||
931 | |||
932 | [[package]] | ||
913 | name = "ra_cli" | 933 | name = "ra_cli" |
914 | version = "0.1.0" | 934 | version = "0.1.0" |
915 | dependencies = [ | 935 | dependencies = [ |
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 | } | ||