Struct Config

struct Config { ... }

Watcher Backend configuration

This contains multiple settings that may relate to only one specific backend, such as to correctly configure each backend regardless of what is selected during runtime.

# use std::time::Duration;
# use notify::Config;
let config = Config::default()
    .with_poll_interval(Duration::from_secs(2))
    .with_compare_contents(true);

Some options can be changed during runtime, others have to be set when creating the watcher backend.

Implementations

impl Config

fn with_poll_interval(self: Self, dur: Duration) -> Self

For the PollWatcher backend.

Interval between each re-scan attempt. This can be extremely expensive for large 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().

fn poll_interval(self: &Self) -> Option<Duration>

Returns current setting

fn with_manual_polling(self: Self) -> Self

For the PollWatcher backend.

Disable automatic polling. Requires calling [crate::PollWatcher::poll()] manually.

This will disable automatic polling, overwriting with_poll_interval().

fn with_compare_contents(self: Self, compare_contents: bool) -> Self

For the PollWatcher backend.

Optional feature that will evaluate the contents of changed files to determine if they have indeed changed using a fast hashing algorithm. This is especially important for pseudo filesystems like those on Linux under /sys and /proc which are not obligated to respect any other filesystem norms such as modification timestamps, file sizes, etc. By enabling this feature, performance will be significantly impacted as all files will need to be read and hashed at each poll_interval.

This can't be changed during runtime. Off by default.

fn compare_contents(self: &Self) -> bool

Returns current setting

For the INotifyWatcher, KqueueWatcher, and PollWatcher.

Determine if symbolic links should be followed when recursively watching a directory.

This can't be changed during runtime. On by default.

Returns current setting

impl Clone for Config

fn clone(self: &Self) -> Config

impl Copy for Config

impl Debug for Config

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

impl Default for Config

fn default() -> Self

impl Eq for Config

impl Freeze for Config

impl Hash for Config

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl PartialEq for Config

fn eq(self: &Self, other: &Config) -> bool

impl RefUnwindSafe for Config

impl Send for Config

impl StructuralPartialEq for Config

impl Sync for Config

impl Unpin for Config

impl UnsafeUnpin for Config

impl UnwindSafe for Config

impl<T> Any for Config

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Config

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Config

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Config

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Config

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Config

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Config

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Config

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Config

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>