fn path_match(watched_paths: &HashSet<PathBuf>, event_path: &Path) -> bool {
    let event_parent = event_path.parent();

    let matches = |watched: &Path| {
        if event_path == watched {
            debug!(
                "Event path ({:?}) directly matches watched path",
                event_path
            );

            return true;
        }

        if let Some(parent) = event_parent {
            if parent == watched {
                debug!(
                    "Event path ({:?}) parent ({:?}) matches watched path",
                    event_path, parent
                );
                return true;
            }
        }

        false
    };

    watched_paths.iter().any(|watched| {
        if matches(watched) {
            return true;
        }

        if let Ok(canonicalized_watch) = watched.canonicalize() {
            if matches(&canonicalized_watch) {
                return true;
            }
        }

        false
    })
}
/// Determine if the event path is covered by our list of watched
/// paths.
///
/// Returns true if:
///   - the event's path directly names a path in our
///     watch list
///   - the event's path names a canonicalized path in our watch list
///   - the event's path's parent directly names a path in our watch
///     list
///   - the event's path's parent names a canonicalized path in our
///     watch list
Determine if the event path is covered by our list of watched
paths.


Determine if the event path is covered by our list of watched paths .
fn path_match(watched_paths: &HashSet<PathBuf>, event_path: &Path) -> bool {
    let event_parent = event_path.parent();
    let matches = |watched: &Path| {
        if event_path == watched {
            debug!(
                "Event path ({:?}) directly matches watched path",
                event_path
            );
            return true;
        }
        if let Some(parent) = event_parent {
            if parent == watched {
                debug!(
                    "Event path ({:?}) parent ({:?}) matches watched path",
                    event_path, parent
                );
                return true;
            }
        }
        false
    };
    watched_paths.iter().any(|watched| {
        if matches(watched) {
            return true;
        }
        if let Ok(canonicalized_watch) = watched.canonicalize() {
            if matches(&canonicalized_watch) {
                return true;
            }
        }
        false
    })
}
fn path_match ( watched_paths : & HashSet < PathBuf > , event_path : & Path ) -> bool { let event_parent = event_path . parent ( ) ; let matches = | watched : & Path | { if event_path == watched { debug ! ( " " event_path ) ; return true ; } if let Some ( parent ) = event_parent { if parent == watched { debug ! ( " " event_path parent ) ; return true ; } } false } ; watched_paths . iter ( ) . any ( | watched | { if matches ( watched ) { return true ; } if let Ok ( canonicalized_watch ) = watched . canonicalize ( ) { if matches ( & canonicalized_watch ) { return true ; } } false } ) }
Determine if the event path is covered by our list of watched
paths.
Determine if the event path is covered by our list of watched paths .
watched_paths
&HashSet<PathBuf>
event_path
&Path
watched_paths
&HashSet<PathBuf>
event_path
&Path