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) -> Self

Creates new instance with provided RecursiveMode

fn with_recursive_mode(self, recursive_mode: RecursiveMode) -> Self

Set RecursiveMode for the watch

fn recursive_mode(&self) -> RecursiveMode

Returns current setting

Set whether a symbolic link is followed to its destination, for RecursiveMode::NonRecursive watches on the INotifyWatcher.

Returns current setting

fn with_user_data(self, user_data: u64) -> Self

Attaches an application-defined value to events and errors from this watch.

All built-in backends expose it through Event::user_data and Error::user_data. Recursive descendants inherit the value; explicitly registered watches keep their own. Rewatching replaces it, and Watcher::watch resets it to None.

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 None if none was set.

Trait Implementations

impl Clone for WatchPathConfig

fn clone(&self) -> Self

impl Debug for WatchPathConfig

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl Freeze for WatchPathConfig

impl RefUnwindSafe for WatchPathConfig

impl Send for WatchPathConfig

impl Sync for WatchPathConfig

impl Unpin for WatchPathConfig

impl UnsafeUnpin for WatchPathConfig

impl UnwindSafe for WatchPathConfig

Blanket Implementations

impl<T> Any for WatchPathConfig where T: 'static + ?Sized,

impl<T> Borrow<T> for WatchPathConfig where T: ?Sized,

impl<T> BorrowMut<T> for WatchPathConfig where T: ?Sized,

impl<T> CloneToUninit for WatchPathConfig where T: Clone,

impl<T> From<T> for WatchPathConfig

impl<T> ToOwned for WatchPathConfig where T: Clone,

impl<T, U> Into<U> for WatchPathConfig where U: From<T>,

impl<T, U> TryFrom<U> for WatchPathConfig where U: Into<T>,

impl<T, U> TryInto<U> for WatchPathConfig where U: TryFrom<T>,