notify/
null.rs

1//! Stub Watcher implementation
2
3#![allow(unused_variables)]
4
5use crate::Config;
6
7use super::{RecursiveMode, Result, Watcher};
8use std::path::Path;
9
10/// Stub `Watcher` implementation
11///
12/// Events are never delivered from this watcher.
13#[derive(Debug)]
14pub struct NullWatcher;
15
16impl Watcher for NullWatcher {
17    fn watch(&mut self, path: &Path, recursive_mode: RecursiveMode) -> Result<()> {
18        Ok(())
19    }
20
21    fn unwatch(&mut self, path: &Path) -> Result<()> {
22        Ok(())
23    }
24
25    fn new<F: crate::EventHandler>(event_handler: F, config: Config) -> Result<Self>
26    where
27        Self: Sized,
28    {
29        Ok(NullWatcher)
30    }
31
32    fn configure(&mut self, config: Config) -> Result<bool> {
33        Ok(false)
34    }
35
36    fn kind() -> crate::WatcherKind {
37        crate::WatcherKind::NullWatcher
38    }
39}