44//!
55//! ```toml
66//! [dependencies]
7- //! notify = "5.0.0-pre.15"
87//! notify-debouncer-mini = "0.1"
98//! ```
109//!
1312//! ```rust,no_run
1413//! # use std::path::Path;
1514//! # use std::time::Duration;
16- //! use notify::{Watcher, RecursiveMode, Result};
17- //! use notify_debouncer_mini::{new_debouncer,DebounceEventResult};
15+ //! use notify_debouncer_mini::{notify::*,new_debouncer,DebounceEventResult};
1816//!
1917//! # fn main() {
18+ //! // setup initial watcher backend config
19+ //! let config = Config::default();
20+ //!
2021//! // Select recommended watcher for debouncer.
2122//! // Using a callback here, could also be a channel.
2223//! let mut debouncer = new_debouncer(Duration::from_secs(2), None, |res: DebounceEventResult| {
@@ -50,6 +51,7 @@ use std::{
5051 time:: { Duration , Instant } ,
5152} ;
5253
54+ pub use notify;
5355use notify:: { Error , ErrorKind , Event , RecommendedWatcher , Watcher } ;
5456
5557/// The set of requirements for watcher debounce event handling functions.
@@ -259,6 +261,7 @@ pub fn new_debouncer_opt<F: DebounceEventHandler, T: Watcher>(
259261 timeout : Duration ,
260262 tick_rate : Option < Duration > ,
261263 mut event_handler : F ,
264+ config : notify:: Config
262265) -> Result < Debouncer < T > , Error > {
263266 let data = DebounceData :: default ( ) ;
264267
@@ -320,7 +323,7 @@ pub fn new_debouncer_opt<F: DebounceEventHandler, T: Watcher>(
320323 // can't have multiple TX, so we need to pipe that through our debouncer
321324 Err ( e) => lock. add_error ( e) ,
322325 }
323- } ) ?;
326+ } , config ) ?;
324327
325328 let guard = Debouncer {
326329 watcher,
@@ -339,7 +342,7 @@ pub fn new_debouncer_opt<F: DebounceEventHandler, T: Watcher>(
339342pub fn new_debouncer < F : DebounceEventHandler > (
340343 timeout : Duration ,
341344 tick_rate : Option < Duration > ,
342- event_handler : F ,
345+ event_handler : F
343346) -> Result < Debouncer < RecommendedWatcher > , Error > {
344- new_debouncer_opt :: < F , RecommendedWatcher > ( timeout, tick_rate, event_handler)
347+ new_debouncer_opt :: < F , RecommendedWatcher > ( timeout, tick_rate, event_handler, notify :: Config :: default ( ) )
345348}
0 commit comments