From 15224dfcd5fc5338844aec5993abf98f7f283e1e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 5 Feb 2019 22:54:17 +0100 Subject: Add new crate --- Cargo.lock | 20 ++++++++++++++++++++ crates/ra_batch/Cargo.toml | 24 ++++++++++++++++++++++++ crates/ra_batch/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 crates/ra_batch/Cargo.toml create mode 100644 crates/ra_batch/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 0009cdaab..53c2498f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" 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 @@ +[package] +edition = "2018" +name = "ra_batch" +version = "0.1.0" +authors = ["Aleksey Kladov "] + +[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" 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 @@ +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, + interner: Arc, + file_counter: u32, +} + +impl salsa::Database for BatchDatabase { + fn salsa_runtime(&self) -> &salsa::Runtime { + &self.runtime + } +} + +impl AsRef for BatchDatabase { + fn as_ref(&self) -> &HirInterner { + &self.interner + } +} -- cgit v1.2.3