Add new crate

This commit is contained in:
Florian Diebold 2019-02-05 22:54:17 +01:00
parent 166c720425
commit 15224dfcd5
3 changed files with 74 additions and 0 deletions

20
Cargo.lock generated
View file

@ -909,6 +909,26 @@ dependencies = [
"test_utils 0.1.0",
]
[[package]]
name = "ra_batch"
version = "0.1.0"
dependencies = [
"fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"insta 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_db 0.1.0",
"ra_hir 0.1.0",
"ra_syntax 0.1.0",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"test_utils 0.1.0",
"unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ra_cli"
version = "0.1.0"

View file

@ -0,0 +1,24 @@
[package]
edition = "2018"
name = "ra_batch"
version = "0.1.0"
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
[dependencies]
itertools = "0.8.0"
join_to_string = "0.1.3"
log = "0.4.5"
relative-path = "0.4.0"
rayon = "1.0.2"
fst = "0.3.1"
rustc-hash = "1.0"
parking_lot = "0.7.0"
unicase = "2.2.0"
ra_syntax = { path = "../ra_syntax" }
ra_db = { path = "../ra_db" }
ra_hir = { path = "../ra_hir" }
[dev-dependencies]
test_utils = { path = "../test_utils" }
insta = "0.6.1"

View file

@ -0,0 +1,30 @@
use std::sync::Arc;
use ra_db::{
FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, SourceDatabase, salsa,
};
use ra_hir::{db, HirInterner};
#[salsa::database(
ra_db::SourceDatabaseStorage,
db::HirDatabaseStorage,
db::PersistentHirDatabaseStorage
)]
#[derive(Debug)]
pub(crate) struct BatchDatabase {
runtime: salsa::Runtime<BatchDatabase>,
interner: Arc<HirInterner>,
file_counter: u32,
}
impl salsa::Database for BatchDatabase {
fn salsa_runtime(&self) -> &salsa::Runtime<BatchDatabase> {
&self.runtime
}
}
impl AsRef<HirInterner> for BatchDatabase {
fn as_ref(&self) -> &HirInterner {
&self.interner
}
}