From 0245625999e728ed3ce8dc6fdd5b6a7ad17e6510 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 21 May 2022 05:17:41 +0200 Subject: [PATCH] examples: fix watcher_kind example to work with the changes from #396 (#407) --- examples/watcher_kind/src/main.rs | 12 ++++++++---- src/poll.rs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/watcher_kind/src/main.rs b/examples/watcher_kind/src/main.rs index 5324e1e0..1b0227ea 100644 --- a/examples/watcher_kind/src/main.rs +++ b/examples/watcher_kind/src/main.rs @@ -1,10 +1,14 @@ use std::time::Duration; -use notify::*; +use notify::{poll::PollWatcherConfig, *}; fn main() { - let (tx, rx) = std::sync::mpsc::channel(); - let watcher: Box = if RecommendedWatcher::kind() == WatcherKind::PollWatcher { - Box::new(PollWatcher::with_delay(tx, Duration::from_secs(1)).unwrap()) + let (tx, _rx) = std::sync::mpsc::channel(); + let _watcher: Box = if RecommendedWatcher::kind() == WatcherKind::PollWatcher { + let config = PollWatcherConfig { + poll_interval: Duration::from_secs(1), + ..Default::default() + }; + Box::new(PollWatcher::with_config(tx, config).unwrap()) } else { Box::new(RecommendedWatcher::new(tx).unwrap()) }; diff --git a/src/poll.rs b/src/poll.rs index 026fce57..b8913f70 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -386,7 +386,7 @@ impl Watcher for PollWatcher { /// Create a new [PollWatcher]. /// /// The default poll frequency is 30 seconds. - /// Use [with_delay] to manually set the poll frequency. + /// Use [with_config] to manually set the poll frequency. fn new(event_handler: F) -> Result { Self::with_config(event_handler, PollWatcherConfig::default()) }