7 releases (major breaking)
| 6.0.0 | May 15, 2025 |
|---|---|
| 5.0.1 | May 15, 2025 |
| 5.0.0 | Feb 9, 2025 |
| 4.0.0 | Oct 14, 2024 |
| 1.0.0 | Mar 18, 2023 |
#642 in Parser implementations
75,080 downloads per month
Used in 42 crates
(14 directly)
55KB
997 lines
watchexec-events
Watchexec's event types.
- API documentation.
- Licensed under Apache 2.0 or MIT.
- Status: maintained.
Fundamentally, events in watchexec have three purposes:
- To trigger the launch, restart, or other interruption of a process;
- To be filtered upon according to whatever set of criteria is desired;
- 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
~2MB
~41K SLoC