use std::{panic, thread, time::Duration};
use treacle::{fold, debouncer};
fn main() {
let (tx, rx) = debouncer(Duration::from_millis(500), fold::fold_vec_push::<u32>);
let t = thread::spawn(move || {
while let Ok(event) = rx.recv() {
println!("{:?}", event);
}
});
for i in 0..100 {
tx.send(i).unwrap();
thread::sleep(Duration::from_millis(50));
}
drop(tx);
if let Err(err) = t.join() {
panic::resume_unwind(err);
}
}