diff options
| author | mo8it <mo8it@proton.me> | 2024-04-14 01:15:43 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-04-14 01:15:43 +0200 |
| commit | 5c0073a9485c4226e58b657cb49628919a28a942 (patch) | |
| tree | 00cd8cb2ca8926e5e6cf68e44d51d14f77cc4695 /src/watch | |
| parent | 2a26dfcb005d2a9ee24e920462b37dfb6d235c32 (diff) | |
Tolerate changes in the state file
Diffstat (limited to 'src/watch')
| -rw-r--r-- | src/watch/notify_event.rs (renamed from src/watch/debounce_event.rs) | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/watch/debounce_event.rs b/src/watch/notify_event.rs index 1dc92cb..0c8d669 100644 --- a/src/watch/debounce_event.rs +++ b/src/watch/notify_event.rs @@ -1,13 +1,11 @@ use notify_debouncer_mini::{DebounceEventResult, DebouncedEventKind}; -use std::sync::mpsc::Sender; - -use crate::exercise::Exercise; +use std::{path::Path, sync::mpsc::Sender}; use super::WatchEvent; pub struct DebounceEventHandler { pub tx: Sender<WatchEvent>, - pub exercises: &'static [Exercise], + pub exercise_paths: &'static [&'static Path], } impl notify_debouncer_mini::DebounceEventHandler for DebounceEventHandler { @@ -23,9 +21,9 @@ impl notify_debouncer_mini::DebounceEventHandler for DebounceEventHandler { return None; } - self.exercises + self.exercise_paths .iter() - .position(|exercise| event.path.ends_with(&exercise.path)) + .position(|path| event.path.ends_with(path)) }) .min() else { |
