10 releases
Uses new Rust 2024
| 0.8.4 | Dec 25, 2025 |
|---|---|
| 0.8.3 | Dec 19, 2025 |
| 0.8.1 | Nov 25, 2025 |
| 0.7.4 | Nov 23, 2025 |
| 0.7.0 | Oct 16, 2025 |
#2510 in Filesystem
420KB
9K
SLoC
Debouncer for notify. Filters incoming events and emits only one event per timeframe per file.
Installation
[dependencies]
notify-debouncer-mini = "0.6.0"
In case you want to select specific features of notify, specify notify as dependency explicitly in your dependencies. Otherwise you can just use the re-export of notify from debouncer-mini.
notify-debouncer-mini = "0.6.0"
notify = { version = "..", features = [".."] }
Examples
See also the full configuration example here.
use notify_debouncer_mini::{notify::*,new_debouncer,DebounceEventResult};
// Select recommended watcher for debouncer.
// Using a callback here, could also be a channel.
let mut debouncer = new_debouncer(Duration::from_secs(2), |res: DebounceEventResult| {
match res {
Ok(events) => events.iter().for_each(|e|println!("Event {:?} for {:?}",e.kind,e.path)),
Err(e) => println!("Error {:?}",e),
}
}).unwrap();
// Add a path to be watched. All files and directories at that path and
// below will be monitored for changes.
debouncer.watcher().watch(Path::new("."), WatchMode::recursive()).unwrap();
// note that dropping the debouncer (as will happen here) also ends the debouncer
// thus this demo would need an endless loop to keep running
Features
The following crate features can be turned on or off in your cargo dependency config:
serdepassed down to notify-types, off by defaultcrossbeam-channelpassed down to notify, off by defaultflumepassed down to notify, off by defaultmacos_fseventpassed down to notify, off by defaultmacos_kqueuepassed down to notify, off by defaultserialization-compat-6passed down to notify, off by default
Caveats
As all file events are sourced from notify, the known problems section applies here too.
Notify debouncer
Tiny debouncer for notify. Filters incoming events and emits only one event per timeframe per file.
Features
-
crossbeam-channelpassed down to notify, off by default -
flumepassed down to notify, off by default -
serdefor serde support of event types, off by default -
serialization-compat-6passed down to notify, off by default
Dependencies
~7–14MB
~199K SLoC