show_events/
show-events.rs

1
2
3
4
5
6
7
8
9
10
11
12
use futures::StreamExt;
use std::env::args;
use wtr_watcher::Watch;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let path = args().nth(1).unwrap_or_else(|| ".".to_string());
    let show = |e| async move { println!("{e:?}") };
    let events = Watch::try_new(&path)?;
    events.for_each(show).await;
    Ok(())
}