pub struct FileWatcher { /* private fields */ }Expand description
File system watcher that detects changes in a project directory.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(root: &Path, config: &WatchConfig) -> Result<Self>
pub fn new(root: &Path, config: &WatchConfig) -> Result<Self>
Create a new file watcher for the given directory.
Uses native OS filesystem events by default (inotify on Linux,
kqueue on macOS, ReadDirectoryChanges on Windows). Falls back to
polling when config.poll_ms is set — useful for network
filesystems that don’t support native events.
Sourcepub fn wait_for_changes(&mut self) -> Vec<PathBuf>
pub fn wait_for_changes(&mut self) -> Vec<PathBuf>
Wait for file changes and return the changed paths (debounced). This blocks until changes are detected.
Sourcepub fn poll_changes(&mut self, timeout: Duration) -> Vec<PathBuf>
pub fn poll_changes(&mut self, timeout: Duration) -> Vec<PathBuf>
Non-blocking poll for file changes with a timeout.
Returns changed paths (debounced) or an empty vec if no changes occurred within the timeout. Does NOT block indefinitely.
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