From 826dbd8cdaddf8be0f3c196eae0d5e1500060474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Thu, 19 Aug 2021 00:40:35 +1200 Subject: [PATCH] Make fs::worker Send --- lib/src/fs.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/src/fs.rs b/lib/src/fs.rs index e6992322..7b2c9925 100644 --- a/lib/src/fs.rs +++ b/lib/src/fs.rs @@ -29,13 +29,13 @@ impl Default for Watcher { } impl Watcher { - fn create(self, f: impl notify::EventFn) -> Result, RuntimeError> { + fn create(self, f: impl notify::EventFn) -> Result, RuntimeError> { match self { Self::Native => { - notify::RecommendedWatcher::new(f).map(|w| Box::new(w) as Box) + notify::RecommendedWatcher::new(f).map(|w| Box::new(w) as _) } Self::Poll => { - notify::PollWatcher::new(f).map(|w| Box::new(w) as Box) + notify::PollWatcher::new(f).map(|w| Box::new(w) as _) } } .map_err(|err| RuntimeError::FsWatcherCreate { kind: self, err }) @@ -90,8 +90,8 @@ pub async fn worker( debug!("launching filesystem worker"); let mut watcher_type = Watcher::default(); - let mut watcher: Option> = None; - let mut pathset: HashSet = HashSet::new(); + let mut watcher = None; + let mut pathset = HashSet::new(); while working.changed().await.is_ok() { // In separate scope so we drop the working read lock as early as we can @@ -187,6 +187,7 @@ pub async fn worker( debug!("ending file watcher"); Ok(()) } + fn process_event( nev: Result, kind: Watcher,