Expand description
FS changes’ notifier.
Simple library to watch file changes inside given directory.
Usage example:
ⓘ
use fs_change_notifier::{create_watcher, match_event, RecursiveMode};
let root = PathBuf::from(".");
let (mut wr, rx) = create_watcher(|e| log::error!("{e:?}")).unwrap();
wr.watch(&root, RecursiveMode::Recursive).unwrap();
loop {
tokio::select! {
_ = your_job => {},
_ = match_event(&root, rx, &exclude) => {
// do your logic on fs update
},
}
}Enums§
- Recursive
Mode - Indicates whether only the provided directory or its sub-directories as well should be watched
Functions§
- create_
watcher - Creates a watcher and an associated MPSC channel receiver.
- fetch_
changed - Matches event and returns changed file.
- match_
event - Matches event and returns on included ones.