diff --git a/examples/debouncer_mini_custom.rs b/examples/debouncer_mini_custom.rs index 91715c3e..c5654a5f 100644 --- a/examples/debouncer_mini_custom.rs +++ b/examples/debouncer_mini_custom.rs @@ -20,13 +20,11 @@ fn main() { // notify backend configuration let backend_config = notify::Config::default().with_poll_interval(Duration::from_secs(1)); // debouncer configuration - let debouncer_config = Config::default().with_timeout(Duration::from_millis(1000)).with_notify_config(backend_config); + let debouncer_config = Config::default() + .with_timeout(Duration::from_millis(1000)) + .with_notify_config(backend_config); // select backend via fish operator, here PollWatcher backend - let mut debouncer = new_debouncer_opt::<_, notify::PollWatcher>( - debouncer_config, - tx, - ) - .unwrap(); + let mut debouncer = new_debouncer_opt::<_, notify::PollWatcher>(debouncer_config, tx).unwrap(); debouncer .watcher() diff --git a/examples/pollwatcher_manual.rs b/examples/pollwatcher_manual.rs index 3fc0f61b..bb440fdd 100644 --- a/examples/pollwatcher_manual.rs +++ b/examples/pollwatcher_manual.rs @@ -20,22 +20,21 @@ fn main() { fn watch>(path: P) -> notify::Result<()> { let (tx, rx) = std::sync::mpsc::channel(); // use the PollWatcher and disable automatic polling - let mut watcher = PollWatcher::new( - tx, - Config::default().with_manual_polling(), - )?; + let mut watcher = PollWatcher::new(tx, Config::default().with_manual_polling())?; // Add a path to be watched. All files and directories at that path and // below will be monitored for changes. watcher.watch(path.as_ref(), RecursiveMode::Recursive)?; // run event receiver on a different thread, we want this one for user input - std::thread::spawn(move ||{for res in rx { - match res { - Ok(event) => println!("changed: {:?}", event), - Err(e) => println!("watch error: {:?}", e), + std::thread::spawn(move || { + for res in rx { + match res { + Ok(event) => println!("changed: {:?}", event), + Err(e) => println!("watch error: {:?}", e), + } } - }}); + }); // wait for any input and poll loop { diff --git a/notify-debouncer-full/src/lib.rs b/notify-debouncer-full/src/lib.rs index 7d2595d5..598ed23a 100644 --- a/notify-debouncer-full/src/lib.rs +++ b/notify-debouncer-full/src/lib.rs @@ -57,9 +57,9 @@ //! - `crossbeam` enabled by default, adds [`DebounceEventHandler`](DebounceEventHandler) support for crossbeam channels. //! Also enables crossbeam-channel in the re-exported notify. You may want to disable this when using the tokio async runtime. //! - `serde` enables serde support for events. -//! +//! //! # Caveats -//! +//! //! As all file events are sourced from notify, the [known problems](https://docs.rs/notify/latest/notify/#known-problems) section applies here too. mod cache; diff --git a/notify-debouncer-mini/src/lib.rs b/notify-debouncer-mini/src/lib.rs index 4bcd9a3c..8965b047 100644 --- a/notify-debouncer-mini/src/lib.rs +++ b/notify-debouncer-mini/src/lib.rs @@ -35,7 +35,7 @@ //! // Add a path to be watched. All files and directories at that path and //! // below will be monitored for changes. //! debouncer.watcher().watch(Path::new("."), RecursiveMode::Recursive).unwrap(); -//! +//! //! // note that dropping the debouncer (as will happen here) also ends the debouncer //! // thus this demo would need an endless loop to keep running //! # } @@ -48,9 +48,9 @@ //! - `crossbeam` enabled by default, adds [`DebounceEventHandler`](DebounceEventHandler) support for crossbeam channels. //! Also enables crossbeam-channel in the re-exported notify. You may want to disable this when using the tokio async runtime. //! - `serde` enables serde support for events. -//! +//! //! # Caveats -//! +//! //! As all file events are sourced from notify, the [known problems](https://docs.rs/notify/latest/notify/#known-problems) section applies here too. #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/notify/src/config.rs b/notify/src/config.rs index c3c66ff5..7c0b59e0 100644 --- a/notify/src/config.rs +++ b/notify/src/config.rs @@ -51,7 +51,7 @@ impl Config { /// file trees so it is recommended to measure and tune accordingly. /// /// The default poll frequency is 30 seconds. - /// + /// /// This will enable automatic polling, overwriting [with_manual_polling](Config::with_manual_polling). pub fn with_poll_interval(mut self, dur: Duration) -> Self { // TODO: v7.0 break signature to option @@ -76,9 +76,9 @@ impl Config { } /// For the [PollWatcher](crate::PollWatcher) backend. - /// + /// /// Disable automatic polling. Requires calling [crate::PollWatcher::poll] manually. - /// + /// /// This will disable automatic polling, overwriting [with_poll_interval](Config::with_poll_interval). pub fn with_manual_polling(mut self) -> Self { self.poll_interval = None; diff --git a/notify/src/lib.rs b/notify/src/lib.rs index 3ee98b8e..f5efaa71 100644 --- a/notify/src/lib.rs +++ b/notify/src/lib.rs @@ -41,12 +41,12 @@ //! Note the `macos_kqueue` requirement here, otherwise no native backend is available on macos. //! //! # Known Problems -//! +//! //! ### Network filesystems -//! +//! //! Network mounted filesystems like NFS may not emit any events for notify to listen to. //! This applies especially to WSL programs watching windows paths ([issue #254](https://github.com/notify-rs/notify/issues/254)). -//! +//! //! A workaround is the [PollWatcher] backend. //! //! ### Docker with Linux on MacOS M1 @@ -92,10 +92,10 @@ //! Note that the [PollWatcher] is not restricted by this limitation, so it may be an alternative if your users can't increase the limit. //! //! ### Watching large directories -//! +//! //! When watching a very large amount of files, notify may fail to receive all events. //! For example the linux backend is documented to not be a 100% reliable source. See also issue [#412](https://github.com/notify-rs/notify/issues/412). -//! +//! //! # Examples //! //! For more examples visit the [examples folder](https://github.com/notify-rs/notify/tree/main/examples) in the repository.