3 stable releases

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

#597 in Parser implementations

Download history 42650/week @ 2024-01-23 44156/week @ 2024-01-30 43156/week @ 2024-02-06 42513/week @ 2024-02-13 42876/week @ 2024-02-20 43370/week @ 2024-02-27 46203/week @ 2024-03-05 49137/week @ 2024-03-12 48543/week @ 2024-03-19 48059/week @ 2024-03-26 47749/week @ 2024-04-02 46090/week @ 2024-04-09 46927/week @ 2024-04-16 24314/week @ 2024-04-23 14362/week @ 2024-04-30 10801/week @ 2024-05-07

103,193 downloads per month
Used in 26 crates (8 directly)

Apache-2.0 OR MIT

53KB
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–13MB
~107K SLoC