4 stable releases (3 major)

4.0.0 Oct 14, 2024
3.0.0 Apr 20, 2024
2.0.1 Nov 29, 2023
1.1.0 Nov 26, 2023
1.0.0 Mar 18, 2023

#504 in Parser implementations

Download history 7184/week @ 2024-07-30 8837/week @ 2024-08-06 9460/week @ 2024-08-13 9026/week @ 2024-08-20 8317/week @ 2024-08-27 10058/week @ 2024-09-03 8333/week @ 2024-09-10 8820/week @ 2024-09-17 11843/week @ 2024-09-24 9453/week @ 2024-10-01 5541/week @ 2024-10-08 8551/week @ 2024-10-15 7255/week @ 2024-10-22 8760/week @ 2024-10-29 9663/week @ 2024-11-05 9386/week @ 2024-11-12

36,190 downloads per month
Used in 30 crates (9 directly)

Apache-2.0 OR MIT

54KB
988 lines

watchexec-events

Watchexec's event types.

Fundamentally, events in watchexec have three purposes:

  1. To trigger the launch, restart, or other interruption of a process;
  2. To be filtered upon according to whatever set of criteria is desired;
  3. To carry information about what caused the event, which may be provided to the process.

Outside of Watchexec, this library is particularly useful if you're building a tool that runs under it, and want to easily read its events (with --emit-events-to=json-file and --emit-events-to=json-stdio).

use std::io::{stdin, Result};
use watchexec_events::Event;

fn main() -> Result<()> {
    for line in stdin().lines() {
        let event: Event = serde_json::from_str(&line?)?;
        dbg!(event);
    }

    Ok(())
}

Features

  • serde: enables serde support.
  • notify: use Notify's file event types (default).

If you disable notify, you'll get a leaner dependency tree that's still able to parse the entire events, but isn't type compatible with Notify. In most deserialisation usecases, this is fine, but it's not the default to avoid surprises.

Dependencies

~2–12MB
~95K SLoC