Trait notify::EventHandler

source ·
pub trait EventHandler: Send + 'static {
    // Required method
    fn handle_event(&mut self, event: Result<Event>);
}
Expand description

The set of requirements for watcher event handling functions.

§Example implementation

use notify::{Event, Result, EventHandler};

/// Prints received events
struct EventPrinter;

impl EventHandler for EventPrinter {
    fn handle_event(&mut self, event: Result<Event>) {
        if let Ok(event) = event {
            println!("Event: {:?}", event);
        }
    }
}

Required Methods§

source

fn handle_event(&mut self, event: Result<Event>)

Handles an event.

Implementations on Foreign Types§

source§

impl EventHandler for Sender<Result<Event>>

source§

fn handle_event(&mut self, event: Result<Event>)

source§

impl EventHandler for Sender<Result<Event>>

source§

fn handle_event(&mut self, event: Result<Event>)

Implementors§

source§

impl<F> EventHandler for F
where F: FnMut(Result<Event>) + Send + 'static,