hotwatch
is a Rust library for comfortably watching and handling file changes. It's a thin convenience wrapper over notify, allowing you to easily spawn handlers.
At least Rust 1.24 is required, due to the requirements of parking_lot
.
```rust use hotwatch::{Hotwatch, Event};
let mut hotwatch = Hotwatch::new().expect("Hotwatch failed to initialize."); hotwatch.watch("war.png", |event: Event| { if let Event::Write(path) = event { println!("War has changed."); } }).expect("Failed to watch file!"); ```
warmy
?warmy
is a more general solution for responding to resource changes. hotwatch
is very simplistic and intends to be trivial to integrate.
I've never actually used warmy
, though. It's probably awesome. I just know that hotwatch
is really easy to use, and has a sexier name.