Struct WatchPathConfig
pub struct WatchPathConfig { /* private fields */ }
Single watch backend configuration
This contains some settings that may relate to only one specific backend, such as to correctly configure each backend regardless of what is selected during runtime.
Implementations
impl WatchPathConfig
fn new(recursive_mode: RecursiveMode) -> SelfCreates new instance with provided
RecursiveModefn with_recursive_mode(self, recursive_mode: RecursiveMode) -> SelfSet
RecursiveModefor the watchfn recursive_mode(&self) -> RecursiveModeReturns current setting
fn with_dereference_symlinks(self, dereference_symlinks: bool) -> SelfSet whether a symbolic link is followed to its destination, for
RecursiveMode::NonRecursivewatches on theINotifyWatcher.fn dereference_symlinks(&self) -> boolReturns current setting
fn with_user_data(self, user_data: u64) -> SelfAttaches an application-defined value to events and errors from this watch.
All built-in backends expose it through
Event::user_dataandError::user_data. Recursive descendants inherit the value; explicitly registered watches keep their own. Rewatching replaces it, andWatcher::watchresets it toNone.use notify::{Event, RecursiveMode, Result, WatchPathConfig, Watcher}; use std::path::Path; # fn main() -> Result<()> { let mut watcher = notify::recommended_watcher(|result: Result<Event>| { if let Ok(event) = result { println!("watch {:?}: {:?}", event.user_data(), event.paths); } })?; watcher.watch_with( Path::new("src"), WatchPathConfig::new(RecursiveMode::Recursive).with_user_data(42), )?; # Ok(()) # }fn user_data(&self) -> Option<u64>Returns the value attached to this watch, or
Noneif none was set.
Trait Implementations
impl Clone for WatchPathConfig
fn clone(&self) -> Self
impl Debug for WatchPathConfig
fn fmt(&self, f: &mut Formatter<'_>) -> Result