pub fn new(event_sink: Box<dyn FileSystemEventSink>) -> Result<Self> {
        let (raw_events_send, raw_events_recv) = std::sync::mpsc::channel();

        std::thread::spawn(move || {
            loop {
                let event = match raw_events_recv.recv() {
                    Ok(e) => e,
                    Err(_) => return,
                };

                let user_event = filter_raw_fs_event(event);
                if let Some(e) = user_event {
                    event_sink.send(e).ok(); // Ignore all errors during event_sink.send
                }
            }
        });

        let raw_watcher = Mutex::new(
            notify::watcher(raw_events_send, Duration::new(0, 0)).map_err(Error::from_inner)?,
        );
        Ok(Self { raw_watcher })
    }
/// Create a new `LocalFileSystemWatcher` instance that emits file system events into the
/// specified event sink.
Create a new `LocalFileSystemWatcher` instance that emits file system events into the
specified event sink.
Create a new ` LocalFileSystemWatcher ` instance that emits file system events into the specified event sink .
pub fn new(event_sink: Box<dyn FileSystemEventSink>) -> Result<Self> {
        let (raw_events_send, raw_events_recv) = std::sync::mpsc::channel();
        std::thread::spawn(move || {
            loop {
                let event = match raw_events_recv.recv() {
                    Ok(e) => e,
                    Err(_) => return,
                };
                let user_event = filter_raw_fs_event(event);
                if let Some(e) = user_event {
                    event_sink.send(e).ok(); // Ignore all errors during event_sink.send
                }
            }
        });
        let raw_watcher = Mutex::new(
            notify::watcher(raw_events_send, Duration::new(0, 0)).map_err(Error::from_inner)?,
        );
        Ok(Self { raw_watcher })
    }
pub fn new ( event_sink : Box < dyn FileSystemEventSink > ) -> Result < Self > { let ( raw_events_send , raw_events_recv ) = std :: sync :: mpsc :: channel ( ) ; std :: thread :: spawn ( move | | { loop { let event = match raw_events_recv . recv ( ) { Ok ( e ) => e , Err ( _ ) => return , } ; let user_event = filter_raw_fs_event ( event ) ; if let Some ( e ) = user_event { event_sink . send ( e ) . ok ( ) ; // Ignore all errors during event_sink.send } } } ) ; let raw_watcher = Mutex :: new ( notify :: watcher ( raw_events_send , Duration :: new ( 0 , 0 ) ) . map_err ( Error :: from_inner ) ? , ) ; Ok ( Self { raw_watcher } ) }
Create a new `LocalFileSystemWatcher` instance that emits file system events into the
specified event sink.
Create a new ` LocalFileSystemWatcher ` instance that emits file system events into the specified event sink .
event_sink
Box<dyn FileSystemEventSink>