pub struct CwdMatcher { /* private fields */ }Expand description
same_cwd with the target canonicalized once and each distinct event cwd
answered from a cache: a replay scan sees the same handful of strings tens
of thousands of times. In repo mode a cwd that is not the monitor’s is
asked of git once and accepted when it shares the repository.
Implementations§
Source§impl CwdMatcher
impl CwdMatcher
pub fn new(cwd: PathBuf, mode: MatchMode) -> Self
pub fn cwd(&self) -> &Path
Sourcepub fn toplevel(&self) -> Option<&Path>
pub fn toplevel(&self) -> Option<&Path>
The monitor’s worktree root when repo mode is active via git.
pub fn repo_mode(&self) -> bool
Sourcepub fn resolve(&mut self, event_cwd: &str) -> Option<CwdMatch>
pub fn resolve(&mut self, event_cwd: &str) -> Option<CwdMatch>
Cached classification of one event cwd.
pub fn matches(&mut self, event_cwd: &str) -> bool
pub fn resolve_event(&mut self, ev: &HookEvent) -> Option<CwdMatch>
pub fn accepts(&mut self, ev: &HookEvent) -> bool
Auto Trait Implementations§
impl Freeze for CwdMatcher
impl RefUnwindSafe for CwdMatcher
impl Send for CwdMatcher
impl Sync for CwdMatcher
impl Unpin for CwdMatcher
impl UnsafeUnpin for CwdMatcher
impl UnwindSafe for CwdMatcher
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more