pub struct FileWatcher { /* private fields */ }
Expand description
Wrapper around a notify::Watcher
. It runs the inner watcher
in a separate thread, and communicates with it via an mpsc::channel
.
Implementations§
Source§impl FileWatcher
impl FileWatcher
pub fn new<T: Notify + 'static>(peer: T) -> Self
Sourcepub fn watch(&mut self, path: &Path, recursive: bool, token: WatchToken)
pub fn watch(&mut self, path: &Path, recursive: bool, token: WatchToken)
Begin watching path
. As DebouncedEvent
s (documented in the
notify crate) arrive, they are stored
with the associated token
and a task is added to the runloop’s
idle queue.
Delivery of events then requires that the runloop’s handler
correctly forward the handle_idle
call to the interested party.
Sourcepub fn watch_filtered<F>(
&mut self,
path: &Path,
recursive: bool,
token: WatchToken,
filter: F,
)
pub fn watch_filtered<F>( &mut self, path: &Path, recursive: bool, token: WatchToken, filter: F, )
Like watch
, but taking a predicate function that filters delivery
of events based on their path.
Sourcepub fn unwatch(&mut self, path: &Path, token: WatchToken)
pub fn unwatch(&mut self, path: &Path, token: WatchToken)
Removes the provided token/path pair from the watch list. Does not stop watching this path, if it is associated with other tokens.
Sourcepub fn take_events(&mut self) -> VecDeque<(WatchToken, DebouncedEvent)>
pub fn take_events(&mut self) -> VecDeque<(WatchToken, DebouncedEvent)>
Takes ownership of this Watcher
’s current event queue.
Auto Trait Implementations§
impl !Freeze for FileWatcher
impl RefUnwindSafe for FileWatcher
impl Send for FileWatcher
impl Sync for FileWatcher
impl Unpin 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