pub struct FileWatcher { /* private fields */ }Expand description
File watcher with debounce and change classification.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(
root: &Path,
test_globs: &[String],
ignore_patterns: &[String],
) -> Result<Self>
pub fn new( root: &Path, test_globs: &[String], ignore_patterns: &[String], ) -> Result<Self>
Create a new file watcher on the given root directory.
Changes are classified using test_match globs from the config.
Debounce window is 100ms.
§Errors
Returns an error if the watcher cannot be created or the path cannot be watched. Create a new file watcher.
root— Directory to watch recursively.test_globs— Glob patterns that identify test files (fromtest_matchconfig).ignore_patterns— Extra directory names to ignore (merged with defaults).
Sourcepub async fn recv(&self) -> Option<ChangeKind>
pub async fn recv(&self) -> Option<ChangeKind>
Receive the next file change event (async).
Sourcepub fn drain_deduped(&self) -> Vec<ChangeKind>
pub fn drain_deduped(&self) -> Vec<ChangeKind>
Non-blocking drain of all pending changes, deduplicated by path.
Auto Trait Implementations§
impl Freeze for FileWatcher
impl RefUnwindSafe for FileWatcher
impl Send for FileWatcher
impl Sync for FileWatcher
impl !Unpin for FileWatcher
impl !UnsafeUnpin for FileWatcher
impl UnwindSafe for FileWatcher
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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