1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
//! Stop watching a path. use notify::Watcher; use std::path::Path; use crate::services::file_watcher::FileWatcher; impl FileWatcher { /// Stop watching a path. /// /// # Arguments /// /// * `path` - Path to stop watching. /// /// # Errors /// /// Returns a `notify::Error` if the path cannot be unwatched. /// /// # Example /// /// ```no_run /// use ratatui_toolkit::services::file_watcher::FileWatcher; /// use std::path::Path; /// /// let mut watcher = FileWatcher::new().unwrap(); /// let path = Path::new("README.md"); /// watcher.watch(path).unwrap(); /// // Later... /// watcher.unwatch(path).unwrap(); /// ``` pub fn unwatch(&mut self, path: &Path) -> Result<(), notify::Error> { self.watcher.unwatch(path) } }