Crates.io | hotwatch |
lib.rs | hotwatch |
version | 0.5.0 |
source | src |
created_at | 2016-11-12 19:49:50.213796 |
updated_at | 2023-06-01 22:54:44.667036 |
description | A Rust library for conveniently watching and handling file changes. |
homepage | https://github.com/francesca64/hotwatch |
repository | https://github.com/francesca64/hotwatch |
max_upload_size | |
id | 7221 |
size | 53,030 |
hotwatch
is a Rust library for comfortably watching and handling file changes. It's a thin convenience wrapper over notify
, allowing you to easily set callbacks for each path you want to watch.
Only the latest stable version of Rust is supported.
use hotwatch::{Hotwatch, Event, EventKind};
let mut hotwatch = Hotwatch::new().expect("hotwatch failed to initialize!");
hotwatch.watch("war.png", |event: Event| {
if let EventKind::Modify(_) = event.kind {
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 sexy name.