diff --git a/fsevent/examples/events.rs b/fsevent/examples/events.rs new file mode 100644 index 0000000000..7f064d9050 --- /dev/null +++ b/fsevent/examples/events.rs @@ -0,0 +1,16 @@ +use fsevent::EventStream; +use std::{env::args, path::Path, time::Duration}; + +fn main() { + let paths = args().skip(1).collect::>(); + let paths = paths.iter().map(Path::new).collect::>(); + assert!(paths.len() > 0, "Must pass 1 or more paths as arguments"); + let stream = EventStream::new(&paths, Duration::from_millis(100), |events| { + eprintln!("event batch"); + for event in events { + eprintln!(" {:?}", event); + } + true + }); + stream.run(); +}