pub struct Matcher { /* private fields */ }Expand description
Match paths against include/exclude patterns, without watching anything.
This uses the same pattern syntax as Watcher (see Watcher::add_include), exposed for
callers that receive paths from somewhere else - a single watcher covering many
independently-configured subtrees, say - and need to decide for themselves which set of rules
a path belongs to.
A pattern naming a directory covers everything inside it. For excludes this mirrors the
watcher exactly: it never descends into an excluded directory, so nothing in there is ever
reported. For includes this is slightly more lenient than the watcher’s event filter, which
reports the named directory itself but requires dir/** to report its contents.
use include_exclude_watcher::Matcher;
let matcher = Matcher::new(&["**/*"], &["node_modules", "*.log"]);
assert!(matcher.matches("src/main.rs"));
assert!(!matcher.matches("node_modules/left-pad/index.js"));
assert!(!matcher.matches("var/app.log"));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Matcher
impl RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnsafeUnpin for Matcher
impl UnwindSafe for Matcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more