pub trait DebounceEventHandler: Send + 'static {
    // Required method
    fn handle_event(&mut self, event: DebounceEventResult);
}
Expand description

The set of requirements for watcher debounce event handling functions.

Example implementation


/// Prints received events
struct EventPrinter;

impl DebounceEventHandler for EventPrinter {
    fn handle_event(&mut self, event: DebounceEventResult) {
        match event {
            Ok(events) => {
                for event in events {
                    println!("Event {:?} for path {:?}",event.kind,event.path);
                }
            },
            // errors are batched, so you get either events or errors, probably both per debounce tick (two calls)
            Err(errors) => errors.iter().for_each(|e|println!("Got error {:?}",e)),
        }
    }
}

Required Methods§

source

fn handle_event(&mut self, event: DebounceEventResult)

Handles an event.

Implementations on Foreign Types§

source§

impl DebounceEventHandler for Sender<DebounceEventResult>

source§

impl DebounceEventHandler for Sender<DebounceEventResult>

Implementors§

source§

impl<F> DebounceEventHandler for Fwhere F: FnMut(DebounceEventResult) + Send + 'static,