pub struct FileWatcher { /* private fields */ }
Expand description
A wrapper around a notify::Watcher
to watch a set of parent
directories in order to learn about changes in some specific files that they
contain.
The Watcher
implementation in notify
has a weakness: it gives sensible
results when you’re watching directories, but if you start watching
non-directory files, it won’t notice when those files get replaced. That’s
a problem for users who want to change their configuration atomically by
making new files and then moving them into place over the old ones.
For more background on the issues with notify
, see
https://github.com/notify-rs/notify/issues/165 and
https://github.com/notify-rs/notify/pull/166.
§Limitations
On backends using kqueue, this uses a polling watcher
to work around a bug in the notify
crate1.
This introduces a perceivable delay,
and can be very expensive for large file trees.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn watching_dirs(&self) -> &HashSet<PathBuf>
pub fn watching_dirs(&self) -> &HashSet<PathBuf>
Method borrowing FileWatcher::watching_dirs
field.
The list of directories that we’re currently watching.
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn builder<R: Runtime>(runtime: R) -> FileWatcherBuilder<R>
pub fn builder<R: Runtime>(runtime: R) -> FileWatcherBuilder<R>
Create a FileWatcherBuilder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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