From 99561cf2f20ad572c7149644a70cd7740c0f8b86 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Dec 2018 13:23:23 +0300 Subject: [PATCH] Add type alias --- crates/ra_vfs/src/io.rs | 4 +++- crates/ra_vfs/src/lib.rs | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ra_vfs/src/io.rs b/crates/ra_vfs/src/io.rs index ce3271d48b0..257f1bf5386 100644 --- a/crates/ra_vfs/src/io.rs +++ b/crates/ra_vfs/src/io.rs @@ -19,7 +19,9 @@ pub enum FileEventKind { Add(String), } -pub fn start() -> (Worker)>, WorkerHandle) { +pub(crate) type FsWorker = Worker)>; + +pub(crate) fn start() -> (FsWorker, WorkerHandle) { thread_worker::spawn::), _>( "vfs", 128, diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs index b80c12058d6..d4ba2cb4550 100644 --- a/crates/ra_vfs/src/lib.rs +++ b/crates/ra_vfs/src/lib.rs @@ -27,10 +27,11 @@ use thread_worker::{WorkerHandle, Worker}; use crate::{ arena::{ArenaId, Arena}, - io::FileEvent, + io::{FileEvent, FsWorker}, }; -/// `RootFilter` is a predicate that checks if a file can belong to a root +/// `RootFilter` is a predicate that checks if a file can belong to a root. If +/// several filters match a file (nested dirs), the most nested one wins. struct RootFilter { root: PathBuf, file_filter: fn(&Path) -> bool, @@ -86,7 +87,7 @@ struct Vfs { roots: Arena, files: Arena, // pending_changes: Vec, - worker: Worker)>, + worker: FsWorker, worker_handle: WorkerHandle, } @@ -101,6 +102,7 @@ impl Vfs { worker_handle, }; + // A hack to make nesting work. roots.sort_by_key(|it| Reverse(it.as_os_str().len())); for path in roots {