aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/project_model.rs
blob: 7d6440fadcc5b0f3f28415d7d3f25859b87cafd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::path::PathBuf;

use thread_worker::Worker;

use crate::Result;

pub use ra_project_model::{
    ProjectWorkspace, CargoWorkspace, Package, Target, TargetKind, Sysroot,
};

pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> {
    Worker::<PathBuf, Result<ProjectWorkspace>>::spawn(
        "workspace loader",
        1,
        |input_receiver, output_sender| {
            input_receiver
                .into_iter()
                .map(|path| ProjectWorkspace::discover(path.as_path()))
                .try_for_each(|it| output_sender.send(it))
                .unwrap()
        },
    )
}