pub struct NotifyWatcher { /* private fields */ }Expand description
File watcher backed by the notify crate.
Wraps a RecommendedWatcher and exposes watch/unwatch methods.
Events are sent to the unbounded receiver returned by NotifyWatcher::new.
Implementations§
Source§impl NotifyWatcher
impl NotifyWatcher
Sourcepub fn new(
ignore: Arc<IgnoreFilter>,
) -> Result<(Self, UnboundedReceiver<WatchEvent>)>
pub fn new( ignore: Arc<IgnoreFilter>, ) -> Result<(Self, UnboundedReceiver<WatchEvent>)>
Create a new watcher with the given ignore filter.
Returns the watcher and an unbounded receiver of WatchEvents.
The receiver should be fed into a SettleBuffer.
§Errors
Returns an error if the OS file watcher cannot be initialized.
Sourcepub fn watch(&mut self, path: &Path) -> Result<()>
pub fn watch(&mut self, path: &Path) -> Result<()>
Start watching a single directory (non-recursive).
Callers are responsible for enumerating subdirectories and watching each one individually. This avoids platform-level recursive watches that can hit OS limits or produce degenerate behaviour on large trees.
§Errors
Returns an error if the path cannot be watched.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NotifyWatcher
impl RefUnwindSafe for NotifyWatcher
impl Send for NotifyWatcher
impl Sync for NotifyWatcher
impl Unpin for NotifyWatcher
impl UnsafeUnpin for NotifyWatcher
impl UnwindSafe for NotifyWatcher
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