#notify #watch #events #filesystem

hotwatch

A Rust library for conveniently watching and handling file changes

10 releases

new 0.4.4 Nov 20, 2020
0.4.3 Dec 3, 2019
0.4.2 Jun 13, 2019
0.4.1 May 31, 2019
0.1.0 Nov 12, 2016

#46 in Filesystem

Download history 60/week @ 2020-08-04 100/week @ 2020-08-11 99/week @ 2020-08-18 103/week @ 2020-08-25 129/week @ 2020-09-01 149/week @ 2020-09-08 86/week @ 2020-09-15 97/week @ 2020-09-22 121/week @ 2020-09-29 77/week @ 2020-10-06 97/week @ 2020-10-13 149/week @ 2020-10-20 77/week @ 2020-10-27 105/week @ 2020-11-03 89/week @ 2020-11-10 174/week @ 2020-11-17

457 downloads per month
Used in less than 10 crates

Apache-2.0/MIT

15KB
221 lines

hotwatch

Crates.io Docs.rs Build Status

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};

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!");

Why should I use this instead of 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.

Dependencies

~360–610KB
~12K SLoC