move thread worker to a separate crate

This commit is contained in:
Aleksey Kladov
2018-12-18 12:45:20 +03:00
parent 4a1ab869b7
commit 193992fd14
9 changed files with 62 additions and 46 deletions

View File

@@ -4,11 +4,9 @@ use cargo_metadata::{metadata_run, CargoOpt};
use ra_syntax::SmolStr;
use rustc_hash::{FxHashMap, FxHashSet};
use failure::{format_err, bail};
use thread_worker::{WorkerHandle, Worker};
use crate::{
Result,
thread_watcher::{ThreadWatcher, Worker},
};
use crate::Result;
/// `CargoWorksapce` represents the logical structure of, well, a Cargo
/// workspace. It pretty closely mirrors `cargo metadata` output.
@@ -199,8 +197,8 @@ impl TargetKind {
}
}
pub fn workspace_loader() -> (Worker<PathBuf, Result<CargoWorkspace>>, ThreadWatcher) {
Worker::<PathBuf, Result<CargoWorkspace>>::spawn(
pub fn workspace_loader() -> (Worker<PathBuf, Result<CargoWorkspace>>, WorkerHandle) {
thread_worker::spawn::<PathBuf, Result<CargoWorkspace>, _>(
"workspace loader",
1,
|input_receiver, output_sender| {