Crates.io | watchexec-events |
lib.rs | watchexec-events |
version | 4.0.0 |
source | src |
created_at | 2023-03-18 11:34:50.998419 |
updated_at | 2024-10-14 10:16:25.896107 |
description | Watchexec's event types |
homepage | |
repository | https://github.com/watchexec/watchexec |
max_upload_size | |
id | 813686 |
size | 63,152 |
Watchexec's event types.
Fundamentally, events in watchexec have three purposes:
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(())
}
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.