pub struct FileWatcher { /* private fields */ }Expand description
A file watcher that monitors a directory tree for changes.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(watch_path: &Path) -> Result<Self, ScannerError>
pub fn new(watch_path: &Path) -> Result<Self, ScannerError>
Create a new file watcher for the given directory.
Starts watching recursively. File events can be received
via the recv method.
Sourcepub fn recv(&self) -> Option<FileEvent>
pub fn recv(&self) -> Option<FileEvent>
Receive the next file event, blocking until one is available.
Sourcepub fn drain_events(&self) -> Vec<FileEvent>
pub fn drain_events(&self) -> Vec<FileEvent>
Drain all pending events (non-blocking).
Sourcepub fn recv_timeout(&self, timeout: Duration) -> Option<FileEvent>
pub fn recv_timeout(&self, timeout: Duration) -> Option<FileEvent>
Receive with timeout.
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