mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Add new crate
This commit is contained in:
parent
166c720425
commit
15224dfcd5
3 changed files with 74 additions and 0 deletions
30
crates/ra_batch/src/lib.rs
Normal file
30
crates/ra_batch/src/lib.rs
Normal 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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue