pub struct FileWatcher { /* private fields */ }Expand description
Simple file change detector using modification timestamps.
Avoids the notify crate dependency by comparing cached mtimes on each
poll call. Only watches files that have been explicitly registered.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(root: PathBuf, patterns: Vec<String>) -> Self
pub fn new(root: PathBuf, patterns: Vec<String>) -> Self
Create a new file watcher for the given root and patterns.
Sourcepub fn poll_changes(&mut self) -> Vec<PathBuf>
pub fn poll_changes(&mut self) -> Vec<PathBuf>
Scan watched files for mtime changes since last check. Returns paths of files that changed or were deleted.
Sourcepub fn watch_directory(&mut self)
pub fn watch_directory(&mut self)
Register all files matching patterns in the root directory (non-recursive).
Sourcepub fn watched_count(&self) -> usize
pub fn watched_count(&self) -> usize
Number of watched files.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether file watching is enabled.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable file watching.
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