fn process(&mut self, watch_event: WatchEvent) -> FsResult<Vec<Event>> {
        let _entries = self.entries.clone();
        let mut _entries = _entries.borrow_mut();

        debug!("handling inotify event {:#?}", watch_event);

        match watch_event {
            WatchEvent::Create { wd, name } | WatchEvent::MovedTo { wd, name, .. } => {
                self.process_create(&wd, name, &mut _entries)
            }
            WatchEvent::Modify { wd } => self.process_modify(&wd),
            WatchEvent::Delete { wd, name } | WatchEvent::MovedFrom { wd, name, .. } => {
                self.process_delete(&wd, name, &mut _entries)
            }
            WatchEvent::Move {
                from_wd,
                from_name,
                to_wd,
                to_name,
            } => {
                // directories can't have hard links so we can expect just one entry for these watch
                // descriptors
                let is_from_path_ok = self
                    .get_first_entry(&from_wd)
                    .map(|entry| self.entry_path_passes(entry, &from_name, &_entries))
                    .unwrap_or(false);

                let is_to_path_ok = self
                    .get_first_entry(&to_wd)
                    .map(|entry| self.entry_path_passes(entry, &to_name, &_entries))
                    .unwrap_or(false);

                if is_to_path_ok && is_from_path_ok {
                    self.process_move(&from_wd, from_name, &to_wd, to_name, &mut _entries)
                } else if is_to_path_ok {
                    self.process_create(&to_wd, to_name, &mut _entries)
                } else if is_from_path_ok {
                    self.process_delete(&from_wd, from_name, &mut _entries)
                } else {
                    // Most likely parent was removed, dropping all child watch descriptors
                    // and we've got the child watch event already queued up
                    debug!("Move event received from targets that are not watched anymore");
                    Ok(Vec::new())
                }
            }
            // Files are being updated too often for inotify to catch up
            WatchEvent::Overflow => Err(Error::WatchOverflow),
        }
    }
/// Handles inotify events and may produce Event(s) that are returned upstream through sender
Handles inotify events and may produce Event(s) that are returned upstream through sender
Handles inotify events and may produce Event ( s ) that are returned upstream through sender
fn process(&mut self, watch_event: WatchEvent) -> FsResult<Vec<Event>> {
        let _entries = self.entries.clone();
        let mut _entries = _entries.borrow_mut();
        debug!("handling inotify event {:#?}", watch_event);
        match watch_event {
            WatchEvent::Create { wd, name } | WatchEvent::MovedTo { wd, name, .. } => {
                self.process_create(&wd, name, &mut _entries)
            }
            WatchEvent::Modify { wd } => self.process_modify(&wd),
            WatchEvent::Delete { wd, name } | WatchEvent::MovedFrom { wd, name, .. } => {
                self.process_delete(&wd, name, &mut _entries)
            }
            WatchEvent::Move {
                from_wd,
                from_name,
                to_wd,
                to_name,
            } => {
                // directories can't have hard links so we can expect just one entry for these watch
                // descriptors
                let is_from_path_ok = self
                    .get_first_entry(&from_wd)
                    .map(|entry| self.entry_path_passes(entry, &from_name, &_entries))
                    .unwrap_or(false);
                let is_to_path_ok = self
                    .get_first_entry(&to_wd)
                    .map(|entry| self.entry_path_passes(entry, &to_name, &_entries))
                    .unwrap_or(false);
                if is_to_path_ok && is_from_path_ok {
                    self.process_move(&from_wd, from_name, &to_wd, to_name, &mut _entries)
                } else if is_to_path_ok {
                    self.process_create(&to_wd, to_name, &mut _entries)
                } else if is_from_path_ok {
                    self.process_delete(&from_wd, from_name, &mut _entries)
                } else {
                    // Most likely parent was removed, dropping all child watch descriptors
                    // and we've got the child watch event already queued up
                    debug!("Move event received from targets that are not watched anymore");
                    Ok(Vec::new())
                }
            }
            // Files are being updated too often for inotify to catch up
            WatchEvent::Overflow => Err(Error::WatchOverflow),
        }
    }
fn process ( & mut self , watch_event : WatchEvent ) -> FsResult < Vec < Event > > { let _entries = self . entries . clone ( ) ; let mut _entries = _entries . borrow_mut ( ) ; debug ! ( " " watch_event ) ; match watch_event { WatchEvent :: Create { wd , name } | WatchEvent :: MovedTo { wd , name , .. } => { self . process_create ( & wd , name , & mut _entries ) } WatchEvent :: Modify { wd } => self . process_modify ( & wd ) , WatchEvent :: Delete { wd , name } | WatchEvent :: MovedFrom { wd , name , .. } => { self . process_delete ( & wd , name , & mut _entries ) } WatchEvent :: Move { from_wd , from_name , to_wd , to_name , } => { // directories can't have hard links so we can expect just one entry for these watch // descriptors let is_from_path_ok = self . get_first_entry ( & from_wd ) . map ( | entry | self . entry_path_passes ( entry , & from_name , & _entries ) ) . unwrap_or ( false ) ; let is_to_path_ok = self . get_first_entry ( & to_wd ) . map ( | entry | self . entry_path_passes ( entry , & to_name , & _entries ) ) . unwrap_or ( false ) ; if is_to_path_ok && is_from_path_ok { self . process_move ( & from_wd , from_name , & to_wd , to_name , & mut _entries ) } else if is_to_path_ok { self . process_create ( & to_wd , to_name , & mut _entries ) } else if is_from_path_ok { self . process_delete ( & from_wd , from_name , & mut _entries ) } else { // Most likely parent was removed, dropping all child watch descriptors // and we've got the child watch event already queued up debug ! ( " " ) ; Ok ( Vec :: new ( ) ) } } // Files are being updated too often for inotify to catch up WatchEvent :: Overflow => Err ( Error :: WatchOverflow ) , } }
Handles inotify events and may produce Event(s) that are returned upstream through sender
Handles inotify events and may produce Event ( s ) that are returned upstream through sender
&mut self
watch_event
WatchEvent
&mut self
watch_event
WatchEvent