pub struct FileWatcher { /* private fields */ }Expand description
Monitors a working directory for file changes using OS-native filesystem
notifications via the notify crate.
The watcher runs as an async task and sends FileChange events through
a channel. It automatically stops after a configurable inactivity timeout.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(root: impl Into<PathBuf>, config: FileWatcherConfig) -> Self
pub fn new(root: impl Into<PathBuf>, config: FileWatcherConfig) -> Self
Create a new file watcher for the given directory.
Sourcepub fn with_defaults(root: impl Into<PathBuf>) -> Self
pub fn with_defaults(root: impl Into<PathBuf>) -> Self
Create a watcher with default configuration.
Sourcepub fn start(&self) -> UnboundedReceiver<FileChange>
pub fn start(&self) -> UnboundedReceiver<FileChange>
Start watching and return a receiver for file changes.
The watcher runs in a background tokio task. It will stop when:
- The inactivity timeout is reached (no changes detected)
- [
stop] is called - The
FileWatcheris dropped
Trait Implementations§
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