Skip to content

Commit 15224df

Browse files
committed
Add new crate
1 parent 166c720 commit 15224df

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

Cargo.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_batch/Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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"

crates/ra_batch/src/lib.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

0 commit comments

Comments
 (0)