everysalsa

This commit is contained in:
Aleksey Kladov 2018-09-15 23:42:01 +03:00
parent e69ff21207
commit fcdf3a52b4
4 changed files with 40 additions and 23 deletions

View file

@ -1,3 +1,7 @@
use std::{
sync::Arc,
hash::{Hash, Hasher},
};
use libeditor::{FileSymbol, file_symbols};
use libsyntax2::{
File,
@ -13,6 +17,12 @@ pub(crate) struct SymbolIndex {
map: fst::Map,
}
impl Hash for SymbolIndex {
fn hash<H: Hasher>(&self, hasher: &mut H) {
self.symbols.hash(hasher)
}
}
impl SymbolIndex {
pub(crate) fn for_files(files: impl ParallelIterator<Item=(FileId, File)>) -> SymbolIndex {
let mut symbols = files
@ -43,7 +53,7 @@ impl SymbolIndex {
impl Query {
pub(crate) fn search(
self,
indices: &[&SymbolIndex],
indices: &[Arc<SymbolIndex>],
token: &JobToken,
) -> Vec<(FileId, FileSymbol)> {